- add overloaded eq to Imager::Matrix2d, since older perls don't seem
to synthesize it from overloaded "".
+ - use T1_StrError() for error messages on modern libt1
+ https://rt.cpan.org/Ticket/Display.html?id=69879
+
+ - actually load the font rather than just adding it to the catalog on
+ creation.
+
+ - Imager::Font->new now produces better error messages for the T1
+ engine.
+
Imager 0.85_01 - 10 Oct 2011
==============
+Imager::Font::T1 1.015
+======================
+
+ - use T1_StrError() for error messages on modern libt1
+ https://rt.cpan.org/Ticket/Display.html?id=69879
+
+ - actually load the font rather than just adding it to the catalog on
+ creation.
+
+ - Imager::Font->new now produces better error messages for the T1
+ engine.
+
Imager::Font::T1 1.014
======================
my $id = 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)";
+ Imager->_set_error(Imager->_error_as_msg);
return;
}
return bless {
font_id = T1_AddFont(pfb);
if (font_id<0) {
mm_log((1,"i_t1_new: Failed to load pfb file '%s' - return code %d.\n",pfb,font_id));
+ t1_push_error();
return font_id;
}
if (T1_SetAfmFileName(font_id,afm)<0) mm_log((1,"i_t1_new: afm loading of '%s' failed.\n",afm));
}
+ if (T1_LoadFont(font_id)) {
+ mm_log((1, "i_t1_new() -> -1 - T1_LoadFont failed (%d)\n", T1_errno));
+ t1_push_error();
+ i_push_error(0, "loading font");
+ T1_DeleteFont(font_id);
+ return -1;
+ }
+
++t1_active_fonts;
+ mm_log((1, "i_t1_new() -> %d\n", font_id));
+
return font_id;
}
static void
t1_push_error(void) {
+#if T1LIB_VERSION > 5 || T1LIB_VERSION == 5 && T1LIB_VERSION >= 1
+ /* I don't know when T1_StrError() was introduced, be conservative */
+ i_push_error(T1_errno, T1_StrError(T1_errno));
+#else
switch (T1_errno) {
case 0:
i_push_error(0, "No error");
default:
i_push_errorf(T1_errno, "unknown error %d", (int)T1_errno);
}
+#endif
}
use strict;
use Imager;
use Imager::Test qw(isnt_image);
-use Test::More tests => 13;
+use Test::More tests => 14;
# extracted from t/t36oofont.t
}
}
+{ # open a non-font as a font (test open failure)
+ local $ENV{LANG} = "C";
+ local $ENV{LC_ALL} = "C";
+ my $font = Imager::Font->new(file => "t/t20oo.t", type => "t1");
+ ok(!$font, "should fail to open test script as a font");
+ print "# ", Imager->errstr, "\n";
+}
+
unless ($ENV{IMAGER_KEEP_FILES}) {
unlink "testout/t36oofont1.ppm";
}