Bug 17600: Standardize our EXPORT_OK
[srvgit] / C4 / Creators / PDF.pm
index 253c53f..e90b0bd 100644 (file)
@@ -4,29 +4,57 @@ package C4::Creators::PDF;
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use strict;
 use warnings;
-use PDF::Reuse;
+use PDF::Reuse qw(
+    prAdd
+    prAltJpeg
+    prBookmark
+    prCompress
+    prDoc
+    prDocDir
+    prDocForm
+    prEnd
+    prExtract
+    prField
+    prFile
+    prFont
+    prFontSize
+    prForm
+    prGetLogBuffer
+    prGraphState
+    prImage
+    prInit
+    prInitVars
+    prJpeg
+    prJs
+    prLink
+    prLog
+    prLogDir
+    prMbox
+    prPage
+    prSinglePage
+    prStrWidth
+    prText
+    prTTFont
+);
 use PDF::Reuse::Barcode;
 use File::Temp;
-use List::Util qw/first/;
+use List::Util qw( first );
 
-BEGIN {
-    use version; our $VERSION = qv('3.07.00.049');
-}
 
 sub _InitVars {
     my $self = shift;
@@ -219,16 +247,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 <font type=\"$font\">/path/to/font.ttf</font>";
-        }
-    }
+    # replace font code with correct internal font
+    $font = C4::Creators::PDF->Font($font);
 
     return prStrWidth($string, $font, $fontSize);
 }
@@ -323,7 +343,7 @@ __END__
 
 =head1 NAME
 
-C4::Creators::PDF -   A class wrapper for PDF::Reuse and PDF::Reuse::Barcode to allow usage as a psuedo-object. For usage see
+C4::Creators::PDF -   A class wrapper for PDF::Reuse and PDF::Reuse::Barcode to allow usage as a pseudo-object. For usage see
                     PDF::Reuse documentation and C4::Creators::PDF code.
 
 =cut