terminate font name with \0
[swftools.git] / lib / modules / swffont.c
index 75069e3..df231e7 100644 (file)
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include "../rfxswf.h"
+
 static int loadfont_scale = 4;
 static int skip_unused = 1;
 static int full_unicode = 0;
@@ -165,7 +169,9 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename)
     font->layout->leading = font->layout->ascent + font->layout->descent;
     font->layout->kerningcount = 0;
     
-    name = FT_Get_Postscript_Name(face);
+    name = face->family_name;
+    if(!(name && *name))
+        name = FT_Get_Postscript_Name(face);
     if(name && *name)
        font->name = (U8*)strdup(name);