MATRIX page_matrix;
- SWF swf;
TAG *tag;
int currentswfid;
int depth;
}
}
- if(u>0) {
+ if(u>0 && font->encoding != 255) {
/* try to use the unicode id */
if(u>=0 && u<font->maxascii && font->ascii2glyph[u]>=0) {
msg("<debug> Char [%d,%s,>%d<] maps to %d\n", charnr, charname, u, font->ascii2glyph[u]);
msg("<warning> Couldn't load font %s (%s)", fontid, filename);
swffont = swf_LoadFont(0);
}
+
+ if(swffont->glyph2ascii) {
+ int t;
+ int bad = 0;
+ /* check whether the Unicode indices look o.k.
+ If they don't, disable the unicode lookup by setting
+ the encoding to 255 */
+ for(t=0;t<swffont->numchars;t++) {
+ int c = swffont->glyph2ascii[t];
+ if(c && c < 32 && swffont->glyph[t].shape->bitlen > 16) {
+ // the character maps into the unicode control character range
+ // between 0001-001f. Yet it is not empty. Treat the one
+ // mapping as broken, and look how many of those we find.
+ bad ++;
+ }
+ }
+ if(bad>5) {
+ msg("<warning> Font %s has bad unicode mapping", swffont->name);
+ swffont->encoding = 255;
+ }
+ }
swf_FontSetID(swffont, ++i->currentswfid);
- if(screenloglevel >= LOGLEVEL_DEBUG) {
+ if(getScreenLogLevel() >= LOGLEVEL_DEBUG) {
// print font information
msg("<debug> Font %s (%s)",swffont->name, filename);
msg("<debug> | ID: %d", swffont->id);
endpage(obj);
swf_GetMatrix(0, &i->page_matrix);
- i->page_matrix.tx = movex;
- i->page_matrix.ty = movey;
+ i->page_matrix.tx = movex*20;
+ i->page_matrix.ty = movey*20;
for(i->depth--;i->depth>=i->startdepth;i->depth--) {
i->tag = swf_InsertTag(i->tag,ST_REMOVEOBJECT2);
i->lastpagesize.xmax = x2;
i->lastpagesize.ymin = y1;
i->lastpagesize.ymax = y2;
- swf_ExpandRect2(&i->swf.movieSize, &i->lastpagesize);
+ swf_ExpandRect2(&obj->swf.movieSize, &i->lastpagesize);
i->firstpage = 0;
}
obj->swffont = 0;
obj->drawmode = -1;
- memset(&i->swf,0x00,sizeof(SWF));
+ memset(&obj->swf,0x00,sizeof(SWF));
memset(&i->lastpagesize,0x00,sizeof(SRECT));
- i->swf.fileVersion = config_flashversion;
- i->swf.frameRate = 0x0040; // 1 frame per 4 seconds
- i->swf.movieSize.xmin = 0;
- i->swf.movieSize.ymin = 0;
- i->swf.movieSize.xmax = 0;
- i->swf.movieSize.ymax = 0;
+ obj->swf.fileVersion = config_flashversion;
+ obj->swf.frameRate = 0x0040; // 1 frame per 4 seconds
+ obj->swf.movieSize.xmin = 0;
+ obj->swf.movieSize.ymin = 0;
+ obj->swf.movieSize.xmax = 0;
+ obj->swf.movieSize.ymax = 0;
- i->swf.firstTag = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
- i->tag = i->swf.firstTag;
+ obj->swf.firstTag = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
+ i->tag = obj->swf.firstTag;
rgb.a = rgb.r = rgb.g = rgb.b = 0xff;
swf_SetRGB(i->tag,&rgb);
i->bboxrectpos = -1;
}
-void swfoutput_save(struct swfoutput* obj, char*filename)
+int swfoutput_save(struct swfoutput* obj, char*filename)
{
swfoutput_internal*i = (swfoutput_internal*)obj->internal;
endpage(obj);
fontlist_t *tmp,*iterator = i->fontlist;
while(iterator) {
- TAG*mtag = i->swf.firstTag;
+ TAG*mtag = obj->swf.firstTag;
if(iterator->swffont) {
mtag = swf_InsertTag(mtag, ST_DEFINEFONT2);
/*if(!storeallcharacters)
if(fi<=0) {
msg("<fatal> Could not create \"%s\". ", FIXNULL(filename));
- exit(1);
+ return 0;
}
i->tag = swf_InsertTag(i->tag,ST_END);
if(config_enablezlib || config_flashversion>=6) {
- if FAILED(swf_WriteSWC(fi,&i->swf))
+ if FAILED(swf_WriteSWC(fi,&obj->swf))
msg("<error> WriteSWC() failed.\n");
} else {
- if FAILED(swf_WriteSWF(fi,&i->swf))
+ if FAILED(swf_WriteSWF(fi,&obj->swf))
msg("<error> WriteSWF() failed.\n");
}
if(filename)
close(fi);
msg("<notice> SWF written\n");
+ return 1;
}
/* Perform cleaning up, complete the swf, and write it out. */
iterator = iterator->next;
delete tmp;
}
- swf_FreeTags(&i->swf);
+ swf_FreeTags(&obj->swf);
free(i);i=0;
memset(obj, 0, sizeof(swfoutput));