From: Tony Cook Date: Tue, 11 Dec 2001 12:58:56 +0000 (+0000) Subject: claes' afm patch X-Git-Tag: Imager-0.48^2~470 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/6b012d62940b379a1f6e9d6d0aeda440cfaf3270 claes' afm patch --- diff --git a/Changes b/Changes index e4d7f66d..1f8a2054 100644 --- a/Changes +++ b/Changes @@ -563,6 +563,7 @@ Revision history for Perl extension Imager. - initialize counter for packing 4 bit data - don't allocate hashboxes as locals since it overflows the stack by default in Darwin + - applied T1 afm patch from Claes Jacobsson ================================================================= diff --git a/Imager.xs b/Imager.xs index 7c2cb7d9..34ce9b57 100644 --- a/Imager.xs +++ b/Imager.xs @@ -1252,7 +1252,7 @@ i_t1_set_aa(st) int st int -i_t1_new(pfb,afm=NULL) +i_t1_new(pfb,afm) char* pfb char* afm diff --git a/lib/Imager/Font/Type1.pm b/lib/Imager/Font/Type1.pm index cfb78f65..26687d2f 100644 --- a/lib/Imager/Font/Type1.pm +++ b/lib/Imager/Font/Type1.pm @@ -37,7 +37,20 @@ sub new { unless ($hsh{file} =~ m!^/! || $hsh{file} =~ m!^\./!) { $hsh{file} = './' . $hsh{file}; } - my $id = Imager::i_t1_new($hsh{file}); + + if($hsh{afm}) { + unless (-e $hsh{afm}) { + $Imager::ERRSTR = "Afm file $hsh{afm} not found"; + return; + } + unless ($hsh{afm} =~ m!^/! || $hsh{afm} =~ m!^\./!) { + $hsh{file} = './' . $hsh{file}; + } + } else { + $hsh{afm} = 0; + } + + my $id = Imager::i_t1_new($hsh{file},$hsh{afm}); unless ($id >= 0) { # the low-level code may miss some error handling $Imager::ERRSTR = "Could not load font ($id)"; return;