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

(-)a/C4/Patroncards/Patroncard.pm (-8 / +15 lines)
Lines 95-104 sub draw_barcode { Link Here
95
    # Default values for barcode scaling are set in constructor to work with pre-existing installations
95
    # Default values for barcode scaling are set in constructor to work with pre-existing installations
96
    my $barcode_height_scale = $self->{'barcode_height_scale'};
96
    my $barcode_height_scale = $self->{'barcode_height_scale'};
97
    my $barcode_width_scale = $self->{'barcode_width_scale'};
97
    my $barcode_width_scale = $self->{'barcode_width_scale'};
98
98
    my $llx = $self->{'llx'} || 0;
99
    my $llx_layout = $self->{'layout'}->{'barcode'}->[0]->{'llx'} || 0;
100
    my $lly = $self->{'lly'} || 0;
101
    my $lly_layout = $self->{'layout'}->{'barcode'}->[0]->{'lly'} || 0;
99
    _draw_barcode(      $self,
102
    _draw_barcode(      $self,
100
                        llx     => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'} * $self->{'unitvalue'},
103
                        llx     => $llx + $llx_layout * $self->{'unitvalue'},
101
                        lly     => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'} * $self->{'unitvalue'},
104
                        lly     => $llx + $llx_layout * $self->{'unitvalue'},
102
                        width   => $self->{'width'} * $barcode_width_scale,
105
                        width   => $self->{'width'} * $barcode_width_scale,
103
                        y_scale_factor  => $self->{'height'} * $barcode_height_scale,
106
                        y_scale_factor  => $self->{'height'} * $barcode_height_scale,
104
                        barcode_type    => $self->{'layout'}->{'barcode'}->[0]->{'type'},
107
                        barcode_type    => $self->{'layout'}->{'barcode'}->[0]->{'type'},
Lines 242-249 sub draw_text { Link Here
242
            $line = join(' ',@orig_line);
245
            $line = join(' ',@orig_line);
243
        }
246
        }
244
        my $text_attribs = shift @$text;
247
        my $text_attribs = shift @$text;
245
        my $origin_llx = $self->{'llx'} + $text_attribs->{'llx'} * $self->{'unitvalue'};
248
        my $llx = $self->{'llx'} || 0;
246
        my $origin_lly = $self->{'lly'} + $text_attribs->{'lly'} * $self->{'unitvalue'};
249
        my $llx_text_attr = $text_attribs->{'llx'} || 0;
250
        my $lly = $self->{'llx'} || 0;
251
        my $lly_text_attr = $text_attribs->{'lly'} || 0;
252
253
        my $origin_llx = $llx + $llx_text_attr * $self->{'unitvalue'};
254
        my $origin_lly = $lly + $lly_text_attr * $self->{'unitvalue'};
247
        my $Tx = 0;     # final text llx
255
        my $Tx = 0;     # final text llx
248
        my $Ty = $origin_lly;   # final text lly
256
        my $Ty = $origin_lly;   # final text lly
249
        my $Tw = 0;     # final text word spacing. See http://www.adobe.com/devnet/pdf/pdf_reference.html ISO 32000-1
257
        my $Tw = 0;     # final text word spacing. See http://www.adobe.com/devnet/pdf/pdf_reference.html ISO 32000-1
Lines 259-265 sub draw_text { Link Here
259
#        my $font_units_width = $m->string_width($line);
267
#        my $font_units_width = $m->string_width($line);
260
#        my $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em;
268
#        my $string_width = ($font_units_width * $text_attribs->{'font_size'}) / $units_per_em;
261
        my $string_width = C4::Creators::PDF->StrWidth($line, $text_attribs->{'font'}, $text_attribs->{'font_size'});
269
        my $string_width = C4::Creators::PDF->StrWidth($line, $text_attribs->{'font'}, $text_attribs->{'font_size'});
262
        if (($string_width + $text_attribs->{'llx'}) > $self->{'width'}) {
270
        if (($string_width + $llx_text_attr) > $self->{'width'}) {
263
            my $cur_line = "";
271
            my $cur_line = "";
264
            WRAP_LINES:
272
            WRAP_LINES:
265
            while (1) {
273
            while (1) {
Lines 298-304 sub draw_text { Link Here
298
            }
306
            }
299
        }
307
        }
300
        else {
308
        else {
301
            ($Tx, $Tw) = text_alignment($origin_llx, $self->{'width'}, $text_attribs->{'llx'} * $self->{'unitvalue'}, $string_width, $line, $text_attribs->{'text_alignment'});
309
            ($Tx, $Tw) = text_alignment($origin_llx, $self->{'width'}, $lly_text_attr * $self->{'unitvalue'}, $string_width, $line, $text_attribs->{'text_alignment'});
302
            $line =~ s/^\s+//g;     # strip naughty leading spaces
310
            $line =~ s/^\s+//g;     # strip naughty leading spaces
303
            push @lines, {line=> $line, Tx => $Tx, Ty => $Ty, Tw => $Tw};
311
            push @lines, {line=> $line, Tx => $Tx, Ty => $Ty, Tw => $Tw};
304
        }
312
        }
305
- 

Return to bug 34532