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);
/* 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;
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;
map_t args;
char* fontfile;
int nr = -1;
+ U8* glyphs_to_include;
msg("<verbose> analyse Command: %s (line %d)", command, line);
for(t=0;t<sizeof(arguments)/sizeof(arguments[0]);t++)
font = (SWFFONT*)malloc(sizeof(SWFFONT));
memset(font, 0, sizeof(SWFFONT));
}
- swf_FontUseUTF8(font, lu(&args, "glyphs"));
- swf_FontPrepareForEditText(font);
+ else
+ {
+ swf_FontPrepareForEditText(font);
+ glyphs_to_include = lu(&args, "glyphs");
+ if (!strcmp(glyphs_to_include, "all"))
+ {
+ swf_FontUseAll(font);
+ font->use->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
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;