From 21ddd4444db6cddf2a02975c95f7dbb1eff3f6c6 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 1 Feb 2004 14:17:28 +0000 Subject: [PATCH] added swf_LoadFont(). --- lib/modules/swffont.c | 25 +++++++++++++++++++++---- lib/rfxswf.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/modules/swffont.c b/lib/modules/swffont.c index 302500a..1663b8e 100644 --- a/lib/modules/swffont.c +++ b/lib/modules/swffont.c @@ -257,6 +257,8 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) #include +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 +} + diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 2b53d83..0291e11 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -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 -- 1.7.10.4