View | Details | Raw Unified | Return to bug 2499
Collapse All | Expand All

(-)a/C4/Labels/Label.pm (-14 / +10 lines)
Lines 274-280 sub _BIB { Link Here
274
sub _BAR {
274
sub _BAR {
275
    my $self = shift;
275
    my $self = shift;
276
    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)
276
    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)
277
    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)
277
    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)
278
    my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
278
    my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
279
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 10% of the label height
279
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 10% of the label height
280
    return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
280
    return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor;
Lines 283-289 sub _BAR { Link Here
283
sub _BIBBAR {
283
sub _BIBBAR {
284
    my $self = shift;
284
    my $self = shift;
285
    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'})
285
    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'})
286
    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)
286
    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)
287
    my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
287
    my $barcode_width = 0.8 * $self->{'width'};                         # this scales the barcode width to 80% of the label width
288
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 10% of the label height
288
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};              # this scales the barcode height to 10% of the label height
289
    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.).
289
    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.).
Lines 295-301 sub _BIBBAR { Link Here
295
sub _BARBIB {
295
sub _BARBIB {
296
    my $self = shift;
296
    my $self = shift;
297
    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'})
297
    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'})
298
    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'})
298
    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'})
299
    my $barcode_width = 0.8 * $self->{'width'};                                                 # this scales the barcode width to 80% of the label width
299
    my $barcode_width = 0.8 * $self->{'width'};                                                 # this scales the barcode width to 80% of the label width
300
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};                                      # this scales the barcode height to 10% of the label height
300
    my $barcode_y_scale_factor = 0.01 * $self->{'height'};                                      # this scales the barcode height to 10% of the label height
301
    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.).
301
    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.).
Lines 457-462 sub draw_label_text { Link Here
457
    # FIXME - returns all items, so you can't get data from an embedded holdings field.
457
    # FIXME - returns all items, so you can't get data from an embedded holdings field.
458
    # TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum).
458
    # TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum).
459
    my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource'));
459
    my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource'));
460
    # calculate how many lines we can write in an area, use line_spacer for height of fontchar
461
    my $textarea_height = $self->{'height'} - ( $self->{'top_text_margin'} + ($self->{'top_text_margin'} * 0.5 )) -
462
       $self->{'barcode_y_scale_factor'} - $params{'line_spacer'};
463
    my $line_height_sum = 0.0;  # accumulator for line height points used
464
460
    LABEL_FIELDS:       # process data for requested fields on current label
465
    LABEL_FIELDS:       # process data for requested fields on current label
461
    for my $field (@$label_fields) {
466
    for my $field (@$label_fields) {
462
        if ($field->{'code'} eq 'itemtype') {
467
        if ($field->{'code'} eq 'itemtype') {
Lines 501-516 sub draw_label_text { Link Here
501
                field_data => $field_data
506
                field_data => $field_data
502
                ) }; 
507
                ) }; 
503
508
504
            # If this is a title field, limit to two lines; all others limit to one... FIXME: this is rather arbitrary
505
            if ($field->{'code'} eq 'title' && scalar(@line) >= 2) {
506
                while (scalar(@line) > 2) {
507
                    pop @line;
508
                }
509
            } else {
510
                while (scalar(@line) > 1) {
511
                    pop @line;
512
                }
513
            }
514
            push(@label_lines, @line);
509
            push(@label_lines, @line);
515
        }
510
        }
516
        LABEL_LINES:    # generate lines of label text for current field
511
        LABEL_LINES:    # generate lines of label text for current field
Lines 528-533 sub draw_label_text { Link Here
528
            else {
523
            else {
529
                $text_llx = ($params{'llx'} + $self->{'left_text_margin'});
524
                $text_llx = ($params{'llx'} + $self->{'left_text_margin'});
530
            }
525
            }
526
            $line_height_sum = $line_height_sum + $params{'line_spacer'};   # incr by size of a line
527
            if ( $line_height_sum > $textarea_height ) { last LABEL_LINES; } # stop drawing if out of bounds
531
            push @label_text,   {
528
            push @label_text,   {
532
                                text_llx        => $text_llx,
529
                                text_llx        => $text_llx,
533
                                text_lly        => $text_lly,
530
                                text_lly        => $text_lly,
534
- 

Return to bug 2499