From 4fd16b07024567008d557f7e91f66983ea686a3d Mon Sep 17 00:00:00 2001 From: eugeni Date: Tue, 5 Sep 2006 20:06:20 +0000 Subject: [PATCH] Workaround for broken fonts with bad ascender/descender. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19699 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libass/ass_render.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libass/ass_render.c b/libass/ass_render.c index 3410014662..e2c8febb82 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1467,17 +1467,21 @@ static void process_karaoke_effects(void) static int get_face_ascender(FT_Face face) { int v = face->size->metrics.ascender; - if (!v) - v = FT_MulFix(face->bbox.yMax, face->size->metrics.y_scale); - return v; + int v2 = FT_MulFix(face->bbox.yMax, face->size->metrics.y_scale); + if (v > v2 * 0.9) + return v; + else + return v2; } static int get_face_descender(FT_Face face) { - int v = face->size->metrics.descender; - if (!v) - v = FT_MulFix(face->bbox.yMin, face->size->metrics.y_scale); - return -v; + int v = - face->size->metrics.descender; + int v2 = - FT_MulFix(face->bbox.yMin, face->size->metrics.y_scale); + if (v > v2 * 0.9) + return v; + else + return v2; } /**