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

(-)a/C4/Creators/Layout.pm (-1 / +1 lines)
Lines 228-234 sub get_text_wrap_cols { Link Here
228
    my $textlimit = $params{'label_width'} - (( 3 * $params{'left_text_margin'} ) || 13.5 );
228
    my $textlimit = $params{'label_width'} - (( 3 * $params{'left_text_margin'} ) || 13.5 );
229
229
230
    while ($strwidth < $textlimit) {
230
    while ($strwidth < $textlimit) {
231
        $string .= '0';
231
        $string .= '8'; # using '8' as filling char instead of '0'
232
        $col_count++;
232
        $col_count++;
233
        $strwidth = C4::Creators::PDF->StrWidth( $string, $self->{'font'}, $self->{'font_size'} );
233
        $strwidth = C4::Creators::PDF->StrWidth( $string, $self->{'font'}, $self->{'font_size'} );
234
    }
234
    }
(-)a/C4/Creators/PDF.pm (-10 / +2 lines)
Lines 219-234 sub StrWidth { Link Here
219
    my $self = shift;
219
    my $self = shift;
220
    my ($string, $font, $fontSize) = @_;
220
    my ($string, $font, $fontSize) = @_;
221
221
222
    # replace font code with path to TTF font file if need be
222
    # replace font code with correct internal font
223
    my $ttf = C4::Context->config('ttf');
223
    $font = C4::Creators::PDF->Font($font);
224
    if ( $ttf ) {
225
        my $ttf_path = first { $_->{type} eq $font } @{ $ttf->{font} };
226
        if ( -e $ttf_path->{content} ) {
227
            $font = $ttf_path->{content};
228
        } else {
229
            warn "ERROR in koha-conf.xml -- missing <font type=\"$font\">/path/to/font.ttf</font>";
230
        }
231
    }
232
224
233
    return prStrWidth($string, $font, $fontSize);
225
    return prStrWidth($string, $font, $fontSize);
234
}
226
}
(-)a/C4/Labels/Label.pm (-3 / +1 lines)
Lines 456-464 sub draw_label_text { Link Here
456
        LABEL_LINES:    # generate lines of label text for current field
456
        LABEL_LINES:    # generate lines of label text for current field
457
        foreach my $line (@label_lines) {
457
        foreach my $line (@label_lines) {
458
            next LABEL_LINES if $line eq '';
458
            next LABEL_LINES if $line eq '';
459
            my $fontName = C4::Creators::PDF->Font($font);
460
            $line = log2vis( $line );
459
            $line = log2vis( $line );
461
            my $string_width = C4::Creators::PDF->StrWidth($line, $fontName, $self->{'font_size'});
460
            my $string_width = C4::Creators::PDF->StrWidth($line, $font, $self->{'font_size'});
462
            if ($self->{'justify'} eq 'R') {
461
            if ($self->{'justify'} eq 'R') {
463
                $text_llx = $params{'llx'} + $self->{'width'} - ($self->{'left_text_margin'} + $string_width);
462
                $text_llx = $params{'llx'} + $self->{'width'} - ($self->{'left_text_margin'} + $string_width);
464
            }
463
            }
465
- 

Return to bug 14468