changeset 19693:3fc2235ff062

Workaround for broken fonts with bad ascender/descender.
author eugeni
date Tue, 05 Sep 2006 20:06:20 +0000
parents 5b40e87b9619
children d32f43ae7f5b
files libass/ass_render.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libass/ass_render.c	Tue Sep 05 19:06:15 2006 +0000
+++ b/libass/ass_render.c	Tue Sep 05 20:06:20 2006 +0000
@@ -1467,17 +1467,21 @@
 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;
 }
 
 /**