1 package Imager::Font::Type1;
5 @ISA = qw(Imager::Font);
10 # $T1AA is in there because for some reason (probably cache related) antialiasing
11 # is a system wide setting in t1 lib.
14 if (!defined $t1aa or $_[0] != $t1aa) {
15 Imager::i_t1_set_aa($_[0]);
22 my %hsh=(color=>Imager::Color->new(255,0,0,0),
27 $Imager::ERRSTR = "No font file specified";
30 unless (-e $hsh{file}) {
31 $Imager::ERRSTR = "Font file $hsh{file} not found";
34 unless ($Imager::formats{t1}) {
35 $Imager::ERRSTR = "Type 1 fonts not supported in this build";
38 unless ($hsh{file} =~ m!^/! || $hsh{file} =~ m!^\./!) {
39 $hsh{file} = File::Spec->catfile(File::Spec->curdir, $hsh{file});
41 my $id = Imager::i_t1_new($hsh{file});
42 unless ($id >= 0) { # the low-level code may miss some error handling
43 $Imager::ERRSTR = "Could not load font ($id)";
59 t1_set_aa_level($input{aa});
60 if (exists $input{channel}) {
61 Imager::i_t1_cp($input{image}{IMG}, $input{x}, $input{'y'},
62 $input{channel}, $self->{id}, $input{size},
63 $input{string}, length($input{string}), $input{align});
65 Imager::i_t1_text($input{image}{IMG}, $input{x}, $input{'y'},
66 $input{color}, $self->{id}, $input{size},
67 $input{string}, length($input{string}),
77 return Imager::i_t1_bbox($self->{id}, $input{size}, $input{string},
78 length($input{string}));
87 Imager::Font::Type1 - low-level functions for Type1 fonts
91 Imager::Font creates a Imager::Font::Type1 object when asked to create
92 a font object based on a .pfb file.
94 See Imager::Font to see how to use this type.
96 This class provides low-level functions that require the caller to
97 perform data validation