From: kramm Date: Sat, 24 May 2008 11:14:54 +0000 (+0000) Subject: applied Huub Schaek's .edittext patch X-Git-Tag: buttons-working~191 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=32bce7795076522c72a9c7f5720a6774f5f8223c applied Huub Schaek's .edittext patch --- diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 064b47e..dcea6be 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -801,6 +801,7 @@ int swf_FontInitUsage(SWFFONT * f) f->use->is_reduced = 0; f->use->used_glyphs = 0; f->use->chars = (int*)rfx_calloc(sizeof(f->use->chars[0]) * f->numchars); + f->use->glyphs_specified = 0; return 0; } diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 87b8604..70a1f35 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -501,6 +501,7 @@ typedef struct _FONTUSAGE { int* chars; char is_reduced; int used_glyphs; + int glyphs_specified; } FONTUSAGE; #define FONT_STYLE_BOLD 1 diff --git a/src/swfc.c b/src/swfc.c index b1b5952..14d5f9a 100644 --- a/src/swfc.c +++ b/src/swfc.c @@ -1546,7 +1546,7 @@ void s_font(char*name, char*filename) swf_FontCreateLayout(font); } font->id = id; - swf_FontReduce_swfc(font); + swf_FontReduce_swfc(font); tag = swf_InsertTag(tag, ST_DEFINEFONT2); swf_FontSetDefine2(tag, font); tag = swf_InsertTag(tag, ST_EXPORTASSETS); @@ -4289,6 +4289,7 @@ static void analyseArgumentsForCommand(char*command) map_t args; char* fontfile; int nr = -1; + U8* glyphs_to_include; msg(" analyse Command: %s (line %d)", command, line); for(t=0;tuse->glyphs_specified = 1; + } + else + { + if (strcmp (glyphs_to_include, "")) + { + swf_FontUseUTF8(font, glyphs_to_include); + font->use->glyphs_specified = 1; + } + else + swf_FontInitUsage(font); + } + } dictionary_put2(&fonts, name, font); } else @@ -4328,10 +4347,16 @@ static void analyseArgumentsForCommand(char*command) if (!font) syntaxerror("font %s is not known in line %d", lu(&args, "font"), line); else - if (!strcmp(command, "edittext")) - swf_FontUseAll(font); - else - swf_FontUseUTF8(font, lu(&args, "text")); + if (font->use && !font->use->glyphs_specified) + { + if (!strcmp(command, "edittext")) + { + swf_FontUseAll(font); + font->use->glyphs_specified = 1; + } + else + swf_FontUseUTF8(font, lu(&args, "text")); + } } map_clear(&args); return;