[MPlayer-cvslog] r19699 - trunk/libass/ass_render.c

eugeni subversion at mplayerhq.hu
Tue Sep 5 22:06:20 CEST 2006


Author: eugeni
Date: Tue Sep  5 22:06:20 2006
New Revision: 19699

Modified:
   trunk/libass/ass_render.c

Log:
Workaround for broken fonts with bad ascender/descender.


Modified: trunk/libass/ass_render.c
==============================================================================
--- trunk/libass/ass_render.c	(original)
+++ trunk/libass/ass_render.c	Tue Sep  5 22:06:20 2006
@@ -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;
 }
 
 /**



More information about the MPlayer-cvslog mailing list