git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ba6811
)
added swf_LoadFont().
author
kramm
<kramm>
Sun, 1 Feb 2004 14:17:28 +0000
(14:17 +0000)
committer
kramm
<kramm>
Sun, 1 Feb 2004 14:17:28 +0000
(14:17 +0000)
lib/modules/swffont.c
patch
|
blob
|
history
lib/rfxswf.h
patch
|
blob
|
history
diff --git
a/lib/modules/swffont.c
b/lib/modules/swffont.c
index
302500a
..
1663b8e
100644
(file)
--- a/
lib/modules/swffont.c
+++ b/
lib/modules/swffont.c
@@
-257,6
+257,8
@@
SWFFONT* swf_LoadTrueTypeFont(char*filename)
#include <t1lib.h>
#include <t1lib.h>
+static int t1lib_initialized = 0;
+
SWFFONT* swf_LoadT1Font(char*filename)
{
SWFFONT * font;
SWFFONT* swf_LoadT1Font(char*filename)
{
SWFFONT * font;
@@
-270,10
+272,13
@@
SWFFONT* swf_LoadT1Font(char*filename)
char**charname;
int c;
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);
}
nr = T1_AddFont(filename);
T1_LoadFont(nr);
@@
-402,3
+407,15
@@
SWFFONT* swf_LoadT1Font(char*filename)
#endif
#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
(file)
--- 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_LoadTrueTypeFont(char*filename);
SWFFONT* swf_LoadT1Font(char*filename);
+SWFFONT* swf_LoadFont(char*filename);
// swfdump.c
// swfdump.c