X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswftext.c;h=06d3eea760289aca7011e7cedd22a1dcdb39d2d0;hb=ccc5f82c2bb8e14ff3941d862e0e5a6feb722201;hp=87c278a9b22646af12772aae8de91939d1b8ba28;hpb=8526dcf3a698c688e2cc4430ae106b5ecf70677f;p=swftools.git diff --git a/lib/modules/swftext.c b/lib/modules/swftext.c index 87c278a..06d3eea 100644 --- a/lib/modules/swftext.c +++ b/lib/modules/swftext.c @@ -1015,11 +1015,13 @@ int swf_TextSetInfoRecord(TAG * t, SWFFONT * font, U16 size, RGBA * color, int d swf_SetRGB(t, color); } if (dx) { + dx &= ~SET_TO_ZERO; if(dx>32767 || dx<-32768) fprintf(stderr, "Warning: Horizontal char position overflow: %d\n", dx); swf_SetS16(t, dx); } if (dy) { + dy &= ~SET_TO_ZERO; if(dy>32767 || dy<-32768) fprintf(stderr, "Warning: Vertical char position overflow: %d\n", dy); swf_SetS16(t, dy); @@ -1152,7 +1154,8 @@ U32 swf_TextGetWidth(SWFFONT * font, U8 * s, int scale) SRECT swf_TextCalculateBBoxUTF8(SWFFONT * font, U8 * s, int scale) { - int pos = 0; + int xpos = 0; + int ypos = 0; SRECT r; swf_GetRect(0, &r); while (*s) { @@ -1161,12 +1164,12 @@ SRECT swf_TextCalculateBBoxUTF8(SWFFONT * font, U8 * s, int scale) int g = font->ascii2glyph[c]; if (g >= 0) { SRECT rn = font->layout->bounds[g]; - rn.xmin = (rn.xmin * scale) / 20 / 100 + pos; - rn.xmax = (rn.xmax * scale) / 20 / 100 + pos; - rn.ymin = (rn.ymin * scale) / 20 / 100; - rn.ymax = (rn.ymax * scale) / 20 / 100; + rn.xmin = (rn.xmin * scale) / 20 / 100 + xpos; + rn.xmax = (rn.xmax * scale) / 20 / 100 + xpos; + rn.ymin = (rn.ymin * scale) / 20 / 100 + ypos; + rn.ymax = (rn.ymax * scale) / 20 / 100 + ypos; swf_ExpandRect2(&r, &rn); - pos += (font->glyph[g].advance * scale) / 20 / 100; + xpos += (font->glyph[g].advance * scale) / 20 / 100; } } c++;