@@ -, +, @@ --- C4/Labels/Label.pm | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) --- a/C4/Labels/Label.pm +++ a/C4/Labels/Label.pm @@ -274,7 +274,7 @@ sub _BIB { sub _BAR { my $self = shift; my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($llx) - my $barcode_lly = $self->{'lly'} + $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance above the bottom of the label ($lly) + my $barcode_lly = $self->{'lly'} + ($self->{'top_text_margin'} *.2); # this places the bottom left of the barcode at 20% of the top text margin distance above the bottom of the label ($lly) my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor; @@ -283,7 +283,7 @@ sub _BAR { sub _BIBBAR { my $self = shift; my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($self->{'llx'}) - my $barcode_lly = $self->{'lly'} + $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance above the bottom of the label ($lly) + my $barcode_lly = $self->{'lly'} + ($self->{'top_text_margin'} * .2); # this places the bottom left of the barcode at 20% of the top text margin distance above the bottom of the label ($lly) my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height my $line_spacer = ($self->{'font_size'} * 1); # number of pixels between text rows (This is actually leading: baseline to baseline minus font size. Recommended starting point is 20% of font size.). @@ -295,7 +295,7 @@ sub _BIBBAR { sub _BARBIB { my $self = shift; my $barcode_llx = $self->{'llx'} + $self->{'left_text_margin'}; # this places the bottom left of the barcode the left text margin distance to right of the left edge of the label ($self->{'llx'}) - my $barcode_lly = ($self->{'lly'} + $self->{'height'}) - $self->{'top_text_margin'}; # this places the bottom left of the barcode the top text margin distance below the top of the label ($self->{'lly'}) + my $barcode_lly = ($self->{'lly'} + $self->{'height'}) - ($self->{'top_text_margin'} * .2); # this places the bottom left of the barcode at 20% of the top text margin distance below the top of the label ($self->{'lly'}) my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height my $line_spacer = ($self->{'font_size'} * 1); # number of pixels between text rows (This is actually leading: baseline to baseline minus font size. Recommended starting point is 20% of font size.). @@ -457,6 +457,11 @@ sub draw_label_text { # FIXME - returns all items, so you can't get data from an embedded holdings field. # TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum). my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource')); + # calculate how many lines we can write in an area, use line_spacer for height of fontchar + my $textarea_height = $self->{'height'} - ( $self->{'top_text_margin'} + ($self->{'top_text_margin'} * 0.5 )) - + $self->{'barcode_y_scale_factor'} - $params{'line_spacer'}; + my $line_height_sum = 0.0; # accumulator for line height points used + LABEL_FIELDS: # process data for requested fields on current label for my $field (@$label_fields) { if ($field->{'code'} eq 'itemtype') { @@ -501,16 +506,6 @@ sub draw_label_text { field_data => $field_data ) }; - # If this is a title field, limit to two lines; all others limit to one... FIXME: this is rather arbitrary - if ($field->{'code'} eq 'title' && scalar(@line) >= 2) { - while (scalar(@line) > 2) { - pop @line; - } - } else { - while (scalar(@line) > 1) { - pop @line; - } - } push(@label_lines, @line); } LABEL_LINES: # generate lines of label text for current field @@ -528,6 +523,8 @@ sub draw_label_text { else { $text_llx = ($params{'llx'} + $self->{'left_text_margin'}); } + $line_height_sum = $line_height_sum + $params{'line_spacer'}; # incr by size of a line + if ( $line_height_sum > $textarea_height ) { last LABEL_LINES; } # stop drawing if out of bounds push @label_text, { text_llx => $text_llx, text_lly => $text_lly, --