use PDF::Reuse;
use PDF::Reuse::Barcode;
use File::Temp;
+use List::Util qw/first/;
BEGIN {
use version; our $VERSION = qv('3.07.00.049');
sub End {
my $self = shift;
- # if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n
- utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream);
+
prEnd();
# slurp temporary filename and print it out for plack to pick up
sub Font {
my $self = shift;
my $fontName = shift;
+
+ my $ttf = C4::Context->config('ttf');
+
+ if ( $ttf ) {
+ my $ttf_path = first { $_->{type} eq $fontName } @{ $ttf->{font} };
+ if ( -e $ttf_path->{content} ) {
+ return prTTFont($ttf_path->{content});
+ } else {
+ warn "ERROR in koha-conf.xml -- missing <font type=\"$fontName\">/path/to/font.ttf</font>";
+ }
+ }
return prFont($fontName);
}
<zebra_auth_index_mode>__AUTH_INDEX_MODE__</zebra_auth_index_mode>
<zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
<queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
+
+ <!-- true type font mapping accoding to type from $font_types in C4/Creators/Lib.pm -->
+ <ttf>
+ <font type="TR" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf</font>
+ <font type="TB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf</font>
+ <font type="TI" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf</font>
+ <font type="TBI">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf</font>
+ <font type="C" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf</font>
+ <font type="CB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf</font>
+ <font type="CO" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf</font>
+ <font type="CBO">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf</font>
+ <font type="H" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf</font>
+ <font type="HB" >/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf</font>
+ <font type="HBO">/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf</font>
+ </ttf>
+
</config>
</yazgfs>
sub _print_text {
my $label_text = shift;
foreach my $text_line (@$label_text) {
- my $pdf_font = $pdf->Font($text_line->{'font'});
- my $line = "BT /$pdf_font $text_line->{'font_size'} Tf $text_line->{'text_llx'} $text_line->{'text_lly'} Td ($text_line->{'line'}) Tj ET";
- utf8::decode($line);
- $pdf->Add($line);
+ $pdf->Font($text_line->{'font'});
+ $pdf->FontSize( $text_line->{'font_size'} );
+ $pdf->Text( $text_line->{'text_llx'}, $text_line->{'text_lly'}, $text_line->{'line'} );
}
}