From af9a9df34566e7a0d78a7ab97de97446045395b4 Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 6 Jan 2006 20:38:20 +0000 Subject: [PATCH] tried to fix bad advance values --- lib/devices/swf.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 7a28fce..3274e86 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -2344,13 +2344,14 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, char* id) for(t=0;tnum_glyphs;t++) { drawer_t draw; gfxline_t*line; + int advance = 0; swffont->glyph2ascii[t] = font->glyphs[t].unicode; if(font->glyphs[t].name) { swffont->glyphnames[t] = strdup(font->glyphs[t].name); } else { swffont->glyphnames[t] = 0; } - swffont->glyph[t].advance = (int)(font->glyphs[t].advance * 20); + advance = (int)(font->glyphs[t].advance * 20); swf_Shape01DrawerInit(&draw, 0); line = font->glyphs[t].line; @@ -2370,6 +2371,18 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, char* id) draw.finish(&draw); swffont->glyph[t].shape = swf_ShapeDrawerToShape(&draw); swffont->layout->bounds[t] = swf_ShapeDrawerGetBBox(&draw); + + if(swffont->layout->bounds[t].xmax*2 < advance) { + printf("fix bad advance value\n"); + advance = swffont->layout->bounds[t].xmax; + } + + if(advance<32768) { + swffont->glyph[t].advance = advance; + } else { + swffont->glyph[t].advance = 32767; + } + draw.dealloc(&draw); swf_ExpandRect2(&bounds, &swffont->layout->bounds[t]); -- 1.7.10.4