X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Fswf.c;h=182aa55f8853527aa2017954409ac5a98576e8c6;hb=922f9285d96ff230c5c6a7017ac7246a0cdf6163;hp=1db6b384615bbd2d146147b5502ea0d463a4d9c9;hpb=5c25a1fc058ae69818976cbb0e6c6b2f6a1aada5;p=swftools.git diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 1db6b38..182aa55 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -1475,10 +1475,6 @@ void swfoutput_finalize(gfxdevice_t*dev) while(iterator) { TAG*mtag = i->swf->firstTag; if(iterator->swffont) { - if(use_font3 && i->config_alignfonts) { - // needs to be done before the reduce - swf_FontCreateAlignZones(iterator->swffont); - } if(!i->config_storeallcharacters) { msg(" Reducing font %s", iterator->swffont->name); swf_FontReduce(iterator->swffont); @@ -1501,7 +1497,7 @@ void swfoutput_finalize(gfxdevice_t*dev) i->tag = swf_InsertTag(i->tag,ST_END); TAG* tag = i->tag->prev; - if(i->config_storeallcharacters) { + if(use_font3 && i->config_storeallcharacters && i->config_alignfonts) { swf_FontPostprocess(i->swf); // generate alignment information } @@ -2817,21 +2813,26 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, const char* id, int version) swffont->glyph2ascii = (U16*)rfx_calloc(sizeof(U16)*swffont->numchars); swffont->glyph = (SWFGLYPH*)rfx_calloc(sizeof(SWFGLYPH)*swffont->numchars); swffont->glyphnames = (char**)rfx_calloc(sizeof(char*)*swffont->numchars); - for(t=0;tmax_unicode;t++) { - swffont->ascii2glyph[t] = font->unicode2glyph[t]; - } + SRECT max = {0,0,0,0}; for(t=0;tnum_glyphs;t++) { drawer_t draw; gfxline_t*line; double advance = 0; - swffont->glyph2ascii[t] = font->glyphs[t].unicode; - if(swffont->glyph2ascii[t] == 0xffff || swffont->glyph2ascii[t] == 0x0000) { + int u = font->glyphs[t].unicode; + int s; + char twice=0; + for(s=0;snum_glyphs;s++) { + if(swffont->glyph2ascii[s]==u) + twice=1; + } + if(u >= 0xe000 || u == 0x0000 || twice) { /* flash 8 flashtype requires unique unicode IDs for each character. We use the Unicode private user area to assign characters, hoping that the font doesn't contain more than 2048 glyphs */ - swffont->glyph2ascii[t] = 0xe000 + (t&0x1fff); + u = 0xe000 + (t&0x1fff); } + swffont->glyph2ascii[t] = u; if(font->glyphs[t].name) { swffont->glyphnames[t] = strdup(font->glyphs[t].name); @@ -2849,6 +2850,11 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, const char* id, int version) c.x = line->sx * scale; c.y = -line->sy * scale; //to.x = floor(line->x * scale); to.y = floor(-line->y * scale); to.x = line->x * scale; to.y = -line->y * scale; + + /*if(strstr(swffont->name, "BIRNU") && t==90) { + to.x += 1; + }*/ + if(line->type == gfx_moveTo) { draw.moveTo(&draw, &to); } else if(line->type == gfx_lineTo) { @@ -2877,6 +2883,7 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, const char* id, int version) swf_ExpandRect2(&bounds, &swffont->layout->bounds[t]); } + for(t=0;tnum_glyphs;t++) { SRECT bbox = swffont->layout->bounds[t]; @@ -2916,6 +2923,7 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, const char* id, int version) if(font->descent*20 > swffont->layout->descent) swffont->layout->descent = font->descent*20; + swf_FontSort(swffont); return swffont; } @@ -3070,6 +3078,7 @@ static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t* msg(" No character %d in font %s (%d chars)", glyph, FIXNULL((char*)i->swffont->name), i->swffont->numchars); return; } + glyph = i->swffont->glyph2glyph[glyph]; setfontscale(dev, matrix->m00, matrix->m01, matrix->m10, matrix->m11, matrix->tx, matrix->ty, 0);