From: kramm Date: Wed, 2 Jun 2004 19:18:05 +0000 (+0000) Subject: Only store max. 256 characters into a font SWF file to prevent X-Git-Tag: release-0-6-0~148 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=3976e328daac108e462695657b52e0137250cb2f Only store max. 256 characters into a font SWF file to prevent against player errors due to a too big SWF bounding box. --- diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 3d6a49b..1e8e7e6 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -927,7 +927,7 @@ void swf_WriteFont(SWFFONT*font, char* filename) { int c; t = swf_InsertTag(t,ST_GLYPHNAMES); - swf_SetU16(t, font->id); + swf_SetU16(t, WRITEFONTID); swf_SetU16(t, font->numchars); for(c=0;cnumchars;c++) { swf_SetString(t, font->glyphnames[c]); @@ -943,9 +943,14 @@ void swf_WriteFont(SWFFONT*font, char* filename) int ypos = 1; U8 gbits,abits; int x,y,c; + int range = font->maxascii; c=0; - for(s=0;smaxascii;s++) + if(useDefineFont2 && range > 256) { + range = 256; + } + + for(s=0;sascii2glyph[s]; if(g>=0) { @@ -989,11 +994,11 @@ void swf_WriteFont(SWFFONT*font, char* filename) rgb.g = 0x00; rgb.b = 0x00; ypos = 1; - for(y=0;y<((font->maxascii+15)/16);y++) + for(y=0;y<((range+15)/16);y++) { int c=0,lastx=-1; for(x=0;x<16;x++) { - int g = (y*16+xmaxascii)?font->ascii2glyph[y*16+x]:-1; + int g = (y*16+xascii2glyph[y*16+x]:-1; if(g>=0 && font->glyph[g].shape) { c++; if(lastx<0) @@ -1004,7 +1009,7 @@ void swf_WriteFont(SWFFONT*font, char* filename) swf_TextSetInfoRecord(t,font,textscale,&rgb,lastx+1,textscale*ypos*2); for(x=0;x<16;x++) { - int g = (y*16+xmaxascii)?font->ascii2glyph[y*16+x]:-1; + int g = (y*16+xascii2glyph[y*16+x]:-1; if(g>=0 && font->glyph[g].shape) { if(lastx != x*xmax) { swf_TextSetInfoRecord(t,0,0,0,x*xmax+1,0);