X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=lib%2Fdevices%2Fswf.c;h=8d557da7c5801692ff72db43754c7a8d9f787c71;hb=c4e8d97d137d32868c97280106819a1f868e361c;hp=121d49ce166763f2756e1e93181ad007a7d44d21;hpb=9b57fcd7feaf69fd54447174b19f5f377706bb15;p=swftools.git diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 121d49c..8d557da 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -114,6 +114,7 @@ typedef struct _swfoutput_internal int config_bboxvars; int config_disable_polygon_conversion; int config_normalize_polygon_positions; + int config_alignfonts; char config_disablelinks; RGBA config_linkcolor; float config_minlinewidth; @@ -623,6 +624,7 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) int lastx; int lasty; int lastsize; + int lastchar; int charids[128]; int charadvance[128]; int charstorepos; @@ -646,6 +648,7 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) lastx = CHARMIDX; lasty = CHARMIDY; lastsize = -1; + lastchar = -1; if(pass==1) { @@ -670,9 +673,9 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) charatposition_t*chr = &chardata->chr[t]; - if(lastfont != chardata->chr[t].font || - lastx!=chardata->chr[t].x || - lasty!=chardata->chr[t].y || + if(lastfont != chr->font || + lastx!=chr->x || + lasty!=chr->y || !colorcompare(&color, &chardata->chr[t].color) || charstorepos==127 || lastsize != chardata->chr[t].size || @@ -736,6 +739,12 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) lastx = chr->x; lasty = chr->y; lastsize = chr->size; + } else { + assert(lastchar>=0); + if(pass==1 && lastchar!=chr->charid) { + swf_FontUsePair(chr->font, lastchar, chr->charid); + swf_FontUsePair(chr->font, chr->charid, lastchar); + } } if(islast) @@ -745,7 +754,7 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) if(tpos-1) nextx = chardata->chr[t+1].x; if(t==chardata->pos-1 && chardata->next) nextx = chardata->next->chr[0].x; int dx = nextx-chr->x; - + int advance; if(dx>=0 && (dx<(1<<(advancebits-1)) || pass==0)) { advance = dx; @@ -754,8 +763,10 @@ static void chararray_writetotag(chararray_t*_chardata, TAG*tag) advance = 0; lastx=chr->x; } + charids[charstorepos] = chr->charid; charadvance[charstorepos] = advance; + lastchar = chr->charid; charstorepos ++; } chardata = chardata->next; @@ -1469,7 +1480,7 @@ void swfoutput_finalize(gfxdevice_t*dev) while(iterator) { TAG*mtag = i->swf->firstTag; if(iterator->swffont) { - if(use_font3) { + if(use_font3 && i->config_alignfonts) { // needs to be done before the reduce swf_FontCreateAlignZones(iterator->swffont); } @@ -3117,6 +3128,6 @@ static void swf_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyph, gfxcolor_t* } else { i->chardata = charbuffer_append(i->chardata, i->swffont, glyph, x, y, i->current_font_size, *(RGBA*)color, &i->fontmatrix); } - swf_FontUseGlyph(i->swffont, glyph); + swf_FontUseGlyph(i->swffont, glyph, i->current_font_size); return; }