From: boehme Date: Mon, 5 Nov 2001 17:01:38 +0000 (+0000) Subject: minor fixes: new font structure in dumpfont.c, commented obsolete functions, ... X-Git-Tag: release-0-1-2~40 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=51c19ac56edb61ae987df0488bb8cd0f8884b37e minor fixes: new font structure in dumpfont.c, commented obsolete functions, ... --- diff --git a/lib/example/dumpfont.c b/lib/example/dumpfont.c index 986f853..c6669bb 100644 --- a/lib/example/dumpfont.c +++ b/lib/example/dumpfont.c @@ -25,7 +25,7 @@ #include #include "../rfxswf.h" -#define PRINTABLE(a) ((a>='A')&&(a<='Z'))||((a>='a')&&(a<='z'))||((a>='0')&&(a<='9')) +#define PRINTABLE(a) (((a>0x20)&&(a<0xff)&&(a!='\\'))?a:0x20) SWF swf; @@ -74,7 +74,7 @@ void DumpFont(SWFFONT * f,char * name) if (f->glyph[i].shape) { printf(" addGlyph(f,%3i, 0x%02x,%4i, &Glyphs_%s[0x%04x],%4i); // %c\n", i, f->glyph2ascii[i], f->glyph[i].advance, name, gpos[i], - f->glyph[i].shape->bitlen,(i!='\\')?i:0x20); + f->glyph[i].shape->bitlen,PRINTABLE(f->glyph2ascii[i])); } printf(" return f;\n}\n\n"); diff --git a/lib/example/text.c b/lib/example/text.c index fb19f7e..9762f10 100644 --- a/lib/example/text.c +++ b/lib/example/text.c @@ -128,6 +128,7 @@ int main(int argc, char ** argv) close(f); swf_FreeTags(&swf); +// swf_FontFree(font); #ifdef __NT__ system("start ..\\text.swf"); diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 270447d..fb708fa 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -372,9 +372,9 @@ int swf_FontReduce(SWFFONT * f,FONTUSAGE * use) } else { swf_ShapeFree(f->glyph[i].shape); - f->ascii2glyph[f->glyph2ascii[i]] = -1; + f->ascii2glyph[f->glyph2ascii[i]] = -1; f->glyph2ascii[i] = 0; - f->glyph[i].shape = 0; + f->glyph[i].shape = NULL; f->glyph[i].advance = 0; } } else f->ascii2glyph[f->glyph2ascii[i]] = -1; @@ -700,10 +700,10 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2) { t = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR); swf.firstTag = t; - rgb.r = 0xff; - rgb.g = 0xff; - rgb.b = 0xff; - swf_SetRGB(t,&rgb); + rgb.r = 0xff; + rgb.g = 0xff; + rgb.b = 0xff; + swf_SetRGB(t,&rgb); t = swf_InsertTag(t,ST_DEFINEFONT); } else @@ -718,8 +718,7 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2) swf_FontSetInfo(t,font); if(!useDefineFont2) - { - int textscale = 400; + { int textscale = 400; int s; int xmax = 0; int ymax = textscale * 20; @@ -791,12 +790,13 @@ void swf_WriteFont(SWFFONT*font, char* filename, int useDefineFont2) } } swf_SetU8(t,0); + - t = swf_InsertTag(t,ST_PLACEOBJECT2); + t = swf_InsertTag(t,ST_PLACEOBJECT2); - swf_ObjectPlace(t,font->id+1,1,NULL,NULL,NULL); + swf_ObjectPlace(t,font->id+1,1,NULL,NULL,NULL); - t = swf_InsertTag(t,ST_SHOWFRAME); + t = swf_InsertTag(t,ST_SHOWFRAME); } t = swf_InsertTag(t,ST_END); diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 724134d..b8dedeb 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -358,6 +358,7 @@ int swf_FontUse(FONTUSAGE * use,U8 * s); int swf_FontSetDefine(TAG * t,SWFFONT * f); int swf_FontSetInfo(TAG * t,SWFFONT * f); +// the following two functions are obsolete and will be removed soon int swf_FontExport(int handle,SWFFONT * f); int swf_FontImport(int handle,SWFFONT * * f);