X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswffont.c;h=ba734092031a66b52ff5ea1391a2c102f84971df;hb=15c3c47514b04bfd2f9222ebbdbd972f8b916cb8;hp=49c5677b6d450da8de522c020d6a56dc217a4992;hpb=e9631a8e0e3870d2d758ba9c584210f64a202419;p=swftools.git diff --git a/lib/modules/swffont.c b/lib/modules/swffont.c index 49c5677..ba73409 100644 --- a/lib/modules/swffont.c +++ b/lib/modules/swffont.c @@ -117,8 +117,10 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) fprintf(stderr, "Couldn't load file %s- not a TTF file?\n", filename); return 0; } - if(face->num_glyphs <= 0) + if(face->num_glyphs <= 0) { + fprintf(stderr, "File %s contains %d glyphs\n", face->num_glyphs); return 0; + } font = malloc(sizeof(SWFFONT)); memset(font, 0, sizeof(SWFFONT)); @@ -215,9 +217,15 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) continue; } error = FT_Load_Glyph(face, t, FT_LOAD_NO_BITMAP|FT_LOAD_NO_SCALE); - if(error) return 0; + if(error) { + fprintf(stderr, "Couldn't load glyph %d\n", t); + continue; + } error = FT_Get_Glyph(face->glyph, &glyph); - if(error) return 0; + if(error) { + fprintf(stderr, "Couldn't get glyph %d\n", t); + continue; + } FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_unscaled, &bbox); bbox.yMin = -bbox.yMin; @@ -239,7 +247,13 @@ SWFFONT* swf_LoadTrueTypeFont(char*filename) //error = FT_Outline_Decompose(&face->glyph->outline, &outline_functions, &draw); error = FT_Outline_Decompose(&face->glyph->outline, &outline_functions, &draw); - if(error) return 0; + draw.finish(&draw); + + if(error) { + fprintf(stderr, "Couldn't decompose glyph %d\n", t); + draw.dealloc(&draw); + continue; + } draw.finish(&draw);