mm_log((1,"Initializing fonts\n"));
#ifdef HAVE_LIBT1
- i_init_t1(t1log);
-#endif
-
-#ifdef HAVE_LIBTT
- i_init_tt();
-#endif
-
-#ifdef HAVE_FT2
- if (!i_ft2_init())
+ if (i_init_t1(t1log))
return 0;
#endif
-
+
return(1); /* FIXME: Always true - check the return values of the init_t1 and init_tt functions */
}
int init_flags = IGNORE_CONFIGFILE|IGNORE_FONTDATABASE;
mm_log((1,"init_t1()\n"));
+ i_clear_error();
+
if (t1_active_fonts) {
mm_log((1, "Cannot re-initialize T1 - active fonts\n"));
+ i_push_error(0, "Cannot re-initialize T1 - active fonts");
return 1;
}
init_flags |= LOGFILE;
if ((T1_InitLib(init_flags) == NULL)){
mm_log((1,"Initialization of t1lib failed\n"));
+ i_push_error(0, "T1_InitLib failed");
return(1);
}
T1_SetLogLevel(T1LOG_DEBUG);
i_t1_new(char *pfb,char *afm) {
int font_id;
+ i_clear_error();
+
+ if (!t1_initialized && i_init_t1(0))
+ return -1;
+
mm_log((1,"i_t1_new(pfb %s,afm %s)\n",pfb,(afm?afm:"NULL")));
font_id = T1_AddFont(pfb);
if (font_id<0) {
/* static globals needed */
+static int TT_initialized = 0;
static TT_Engine engine;
static int LTT_dpi = 72; /* FIXME: this ought to be a part of the call interface */
static int LTT_hinted = 1; /* FIXME: this too */
*/
undef_int
-i_init_tt() {
+i_init_tt(void) {
TT_Error error;
TT_Byte palette[] = { 0, 64, 127, 191, 255 };
+ i_clear_error();
+
mm_log((1,"init_tt()\n"));
error = TT_Init_FreeType( &engine );
if ( error ){
mm_log((1,"Initialization of freetype failed, code = 0x%x\n",error));
+ i_tt_push_error(error);
+ i_push_error(0, "Could not initialize freetype 1.x");
return(1);
}
error = TT_Init_Post_Extension( engine );
if (error) {
mm_log((1, "Initialization of Post extension failed = 0x%x\n", error));
+
+ i_tt_push_error(error);
+ i_push_error(0, "Could not initialize FT 1.x POST extension");
return 1;
}
#endif
error = TT_Set_Raster_Gray_Palette(engine, palette);
if (error) {
mm_log((1, "Initialization of gray levels failed = 0x%x\n", error));
+ i_tt_push_error(error);
+ i_push_error(0, "Could not initialize FT 1.x POST extension");
return 1;
}
+ TT_initialized = 1;
+
return(0);
}
unsigned short i,n;
unsigned short platform,encoding;
+ if (!TT_initialized && i_init_tt()) {
+ i_push_error(0, "Could not initialize FT1 engine");
+ return NULL;
+ }
+
i_clear_error();
mm_log((1,"i_tt_new(fontname '%s')\n",fontname));
static void ft2_push_message(int code);
+static ft2_initialized = 0;
static FT_Library library;
/*
i_push_error(0, "Initializing Freetype2");
return 0;
}
+
+ ft2_initialized = 1;
+
return 1;
}
mm_log((1, "i_ft2_new(name %p, index %d)\n", name, index));
+ if (!ft2_initialized && !i_ft2_init())
+ return NULL;
+
i_clear_error();
error = FT_New_Face(library, name, index, &face);
if (error) {
print "# has t1\n";
- i_t1_set_aa(1);
+ #i_t1_set_aa(1);
unlink "t1lib.log"; # lose it if it exists
init(t1log=>0);
is(length($exists), 2, "return scalar length");
ok(ord(substr($exists, 0, 1)), "we have an exclamation mark");
ok(!ord(substr($exists, 1, 1)), "we have no upper-case A");
+ i_t1_destroy($font_num);
}
my $font = Imager::Font->new(file=>$exists_font, type=>'t1');