From c4bf7f42ef038c285b5a53f0a43f68f5c7f339e6 Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 3 Dec 2005 14:28:22 +0000 Subject: [PATCH] fixed layout information (leading, ascent/descent) --- lib/devices/swf.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/devices/swf.c b/lib/devices/swf.c index 0cafe47..4e623b0 100644 --- a/lib/devices/swf.c +++ b/lib/devices/swf.c @@ -2311,6 +2311,7 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, char* id) { SWFFONT*swffont = (SWFFONT*)rfx_calloc(sizeof(SWFFONT)); int t; + SRECT bounds = {0,0,0,0}; swffont->id = -1; swffont->version = 2; swffont->name = (U8*)strdup(id); @@ -2359,7 +2360,19 @@ static SWFFONT* gfxfont_to_swffont(gfxfont_t*font, char* id) swffont->glyph[t].shape = swf_ShapeDrawerToShape(&draw); swffont->layout->bounds[t] = swf_ShapeDrawerGetBBox(&draw); draw.dealloc(&draw); + + swf_ExpandRect2(&bounds, &swffont->layout->bounds[t]); + } + if(bounds.ymin < 0 && bounds.ymax > 0) { + swffont->layout->ascent = -bounds.ymin; + swffont->layout->descent = bounds.ymax; + swffont->layout->leading = bounds.ymax - bounds.ymin; + } else { + swffont->layout->ascent = (bounds.ymax - bounds.ymin)/2; + swffont->layout->descent = (bounds.ymax - bounds.ymin)/2; + swffont->layout->leading = bounds.ymax - bounds.ymin; } + return swffont; } -- 1.7.10.4