|
Lines 267-273
sub _BIB {
Link Here
|
| 267 |
sub _BAR { |
267 |
sub _BAR { |
| 268 |
my $self = shift; |
268 |
my $self = shift; |
| 269 |
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) |
269 |
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) |
| 270 |
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) |
270 |
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) |
| 271 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
271 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
| 272 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
272 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
| 273 |
return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor; |
273 |
return 0, 0, 0, $barcode_llx, $barcode_lly, $barcode_width, $barcode_y_scale_factor; |
|
Lines 276-282
sub _BAR {
Link Here
|
| 276 |
sub _BIBBAR { |
276 |
sub _BIBBAR { |
| 277 |
my $self = shift; |
277 |
my $self = shift; |
| 278 |
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'}) |
278 |
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'}) |
| 279 |
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) |
279 |
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) |
| 280 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
280 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
| 281 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
281 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
| 282 |
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.). |
282 |
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 288-294
sub _BIBBAR {
Link Here
|
| 288 |
sub _BARBIB { |
288 |
sub _BARBIB { |
| 289 |
my $self = shift; |
289 |
my $self = shift; |
| 290 |
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'}) |
290 |
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'}) |
| 291 |
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'}) |
291 |
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'}) |
| 292 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
292 |
my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width |
| 293 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
293 |
my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 10% of the label height |
| 294 |
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.). |
294 |
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 450-455
sub draw_label_text {
Link Here
|
| 450 |
# FIXME - returns all items, so you can't get data from an embedded holdings field. |
450 |
# FIXME - returns all items, so you can't get data from an embedded holdings field. |
| 451 |
# TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum). |
451 |
# TODO - add a GetMarcBiblio1item(bibnum,itemnum) or a GetMarcItem(itemnum). |
| 452 |
my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource')); |
452 |
my $cn_source = ($item->{'cn_source'} ? $item->{'cn_source'} : C4::Context->preference('DefaultClassificationSource')); |
|
|
453 |
# calculate how many lines we can write in an area, use line_spacer for height of fontchar |
| 454 |
my $textarea_height = $self->{'height'} - ( $self->{'top_text_margin'} + ($self->{'top_text_margin'} * 0.5 )) - |
| 455 |
$self->{'barcode_y_scale_factor'} - $params{'line_spacer'}; |
| 456 |
my $line_height_sum = 0.0; # accumulator for line height points used |
| 457 |
|
| 453 |
LABEL_FIELDS: # process data for requested fields on current label |
458 |
LABEL_FIELDS: # process data for requested fields on current label |
| 454 |
for my $field (@$label_fields) { |
459 |
for my $field (@$label_fields) { |
| 455 |
if ($field->{'code'} eq 'itemtype') { |
460 |
if ($field->{'code'} eq 'itemtype') { |
|
Lines 494-509
sub draw_label_text {
Link Here
|
| 494 |
field_data => $field_data |
499 |
field_data => $field_data |
| 495 |
) }; |
500 |
) }; |
| 496 |
|
501 |
|
| 497 |
# If this is a title field, limit to two lines; all others limit to one... FIXME: this is rather arbitrary |
|
|
| 498 |
if ($field->{'code'} eq 'title' && scalar(@line) >= 2) { |
| 499 |
while (scalar(@line) > 2) { |
| 500 |
pop @line; |
| 501 |
} |
| 502 |
} else { |
| 503 |
while (scalar(@line) > 1) { |
| 504 |
pop @line; |
| 505 |
} |
| 506 |
} |
| 507 |
push(@label_lines, @line); |
502 |
push(@label_lines, @line); |
| 508 |
} |
503 |
} |
| 509 |
LABEL_LINES: # generate lines of label text for current field |
504 |
LABEL_LINES: # generate lines of label text for current field |
|
Lines 521-526
sub draw_label_text {
Link Here
|
| 521 |
else { |
516 |
else { |
| 522 |
$text_llx = ($params{'llx'} + $self->{'left_text_margin'}); |
517 |
$text_llx = ($params{'llx'} + $self->{'left_text_margin'}); |
| 523 |
} |
518 |
} |
|
|
519 |
$line_height_sum = $line_height_sum + $params{'line_spacer'}; # incr by size of a line |
| 520 |
if ( $line_height_sum > $textarea_height ) { last LABEL_LINES; } # stop drawing if out of bounds |
| 524 |
push @label_text, { |
521 |
push @label_text, { |
| 525 |
text_llx => $text_llx, |
522 |
text_llx => $text_llx, |
| 526 |
text_lly => $text_lly, |
523 |
text_lly => $text_lly, |
| 527 |
- |
|
|