diff --git a/C4/Creators/Layout.pm b/C4/Creators/Layout.pm index cf0b751eff..83274afb3e 100644 --- a/C4/Creators/Layout.pm +++ b/C4/Creators/Layout.pm @@ -230,7 +230,7 @@ sub get_text_wrap_cols { my $textlimit = $params{'label_width'} - (( 3 * $params{'left_text_margin'} ) || 13.5 ); while ($strwidth < $textlimit) { - $string .= '0'; + $string .= '8'; # using '8' as filling char instead of '0' $col_count++; $strwidth = C4::Creators::PDF->StrWidth( $string, $self->{'font'}, $self->{'font_size'} ); } diff --git a/C4/Creators/PDF.pm b/C4/Creators/PDF.pm index dd0d3f6d9f..e0c8847128 100644 --- a/C4/Creators/PDF.pm +++ b/C4/Creators/PDF.pm @@ -219,16 +219,8 @@ sub StrWidth { my $self = shift; my ($string, $font, $fontSize) = @_; - # replace font code with path to TTF font file if need be - my $ttf = C4::Context->config('ttf'); - if ( $ttf ) { - my $ttf_path = first { $_->{type} eq $font } @{ $ttf->{font} }; - if ( -e $ttf_path->{content} ) { - $font = $ttf_path->{content}; - } else { - warn "ERROR in koha-conf.xml -- missing /path/to/font.ttf"; - } - } + # replace font code with correct internal font + $font = C4::Creators::PDF->Font($font); return prStrWidth($string, $font, $fontSize); } diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index ca12437412..42554b4cfe 100644 --- a/C4/Labels/Label.pm +++ b/C4/Labels/Label.pm @@ -468,9 +468,8 @@ sub draw_label_text { LABEL_LINES: # generate lines of label text for current field foreach my $line (@label_lines) { next LABEL_LINES if $line eq ''; - my $fontName = C4::Creators::PDF->Font($font); $line = log2vis( $line ); - my $string_width = C4::Creators::PDF->StrWidth($line, $fontName, $self->{'font_size'}); + my $string_width = C4::Creators::PDF->StrWidth($line, $font, $self->{'font_size'}); if ($self->{'justify'} eq 'R') { $text_llx = $params{'llx'} + $self->{'width'} - ($self->{'left_text_margin'} + $string_width); }