]> git.imager.perl.org - imager.git/blobdiff - freetyp2.c
0.73 release
[imager.git] / freetyp2.c
index d0409970eced396945be4a820cf1bcb3315202ee..d2e3c0695d6fad151ab334b963dffe7a91fa0416 100644 (file)
@@ -47,6 +47,7 @@ Truetype, Type1 and Windows FNT.
 
 static void ft2_push_message(int code);
 
+static int ft2_initialized = 0;
 static FT_Library library;
 
 /*
@@ -69,6 +70,9 @@ i_ft2_init(void) {
     i_push_error(0, "Initializing Freetype2");
     return 0;
   }
+
+  ft2_initialized = 1;
+
   return 1;
 }
 
@@ -132,6 +136,9 @@ i_ft2_new(const char *name, int index) {
 
   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) {