added swf_LoadFont().
authorkramm <kramm>
Sun, 1 Feb 2004 14:17:28 +0000 (14:17 +0000)
committerkramm <kramm>
Sun, 1 Feb 2004 14:17:28 +0000 (14:17 +0000)
lib/modules/swffont.c
lib/rfxswf.h

index 302500a..1663b8e 100644 (file)
@@ -257,6 +257,8 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
 
 #include <t1lib.h>
 
+static int t1lib_initialized = 0;
+
 SWFFONT* swf_LoadT1Font(char*filename)
 {
     SWFFONT * font;
@@ -270,10 +272,13 @@ SWFFONT* swf_LoadT1Font(char*filename)
     char**charname;
     int c;
 
-    T1_SetBitmapPad(16);
-    if ((T1_InitLib(NO_LOGFILE)==NULL)){
-       fprintf(stderr, "Initialization of t1lib failed\n");
-       return 0;
+    if(!t1lib_initialized) {
+       T1_SetBitmapPad(16);
+       if ((T1_InitLib(NO_LOGFILE)==NULL)){
+           fprintf(stderr, "Initialization of t1lib failed\n");
+           return 0;
+       }
+       t1lib_initialized = 1;
     }
     nr = T1_AddFont(filename);
     T1_LoadFont(nr);
@@ -402,3 +407,15 @@ SWFFONT* swf_LoadT1Font(char*filename)
 
 #endif
 
+SWFFONT* swf_LoadFont(char*filename)
+{
+#if defined(USE_FREETYPE)
+    return swf_LoadTrueTypeFont(filename);
+#elif defined(HAVE_T1LIB)
+    return swf_LoadT1Font(filename);
+#else
+    fprintf(stderr, "Error: Neither T1lib nor FreeType support compiled in. Could not load %s\n", infile);
+    return 0;
+#endif
+}
+
index 2b53d83..0291e11 100644 (file)
@@ -588,6 +588,7 @@ void swf_DrawText(drawer_t*draw, SWFFONT*font, char*text);
 
 SWFFONT* swf_LoadTrueTypeFont(char*filename);
 SWFFONT* swf_LoadT1Font(char*filename);
+SWFFONT* swf_LoadFont(char*filename);
 
 // swfdump.c