X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfc.c;h=14d5f9a90ce360a91859a7e5844913475f0ad271;hb=32bce7795076522c72a9c7f5720a6774f5f8223c;hp=0601ed14f95c2c729cb5192068cbdc96614b60e5;hpb=964c7d56c721723424722fbbfead601cf1e57a68;p=swftools.git diff --git a/src/swfc.c b/src/swfc.c index 0601ed1..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); @@ -2404,17 +2404,15 @@ int parseTwip(char*str) /* TODO: make this a proper expression parser */ char*p = str; int val = 0; - int add = 1; + char ex = 0; char*lastpos = str; while(*p) { - if(*p == '+') - add = 1; - else if(*p == '-') - add = -1; + if(*p == '+' || *p == '-' || *p == '/' || *p == '*') + ex = *p; else if(!lastpos) lastpos = p; p++; - if((*p == '+' || *p == '-' || *p == 0) && lastpos) { + if((*p == '+' || *p == '-' || *p == '/' || *p == '*' || *p == 0) && lastpos) { char save = *p; *p = 0; @@ -2429,9 +2427,18 @@ int parseTwip(char*str) v = parseRawTwip(lastpos); } *p = save; - val += v*add; + if(ex == '+') + val += v; + else if(ex == '-') + val -= v; + else if(ex == '/') + val = (val*20) / v; + else if(ex == '*') + val = (val*v) / 20; + else + val += v; + ex = 0; lastpos = 0; - add = 1; } } return val; @@ -4282,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 @@ -4321,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;