[MPlayer-cvslog] r24003 - trunk/libass/ass_font.c

eugeni subversion at mplayerhq.hu
Fri Aug 3 17:39:38 CEST 2007


Author: eugeni
Date: Fri Aug  3 17:39:38 2007
New Revision: 24003

Log:
Don't apply windows-like font scaling if hhea or os2 tables contain invalid
metrics.


Modified:
   trunk/libass/ass_font.c

Modified: trunk/libass/ass_font.c
==============================================================================
--- trunk/libass/ass_font.c	(original)
+++ trunk/libass/ass_font.c	Fri Aug  3 17:39:38 2007
@@ -204,8 +204,12 @@ static void face_set_size(FT_Face face, 
 	FT_Size_Metrics *m = &face->size->metrics;
 	// VSFilter uses metrics from TrueType OS/2 table
 	// The idea was borrowed from asa (http://asa.diac24.net)
-	if (hori && os2)
-		mscale = ((double)(hori->Ascender - hori->Descender)) / (os2->usWinAscent + os2->usWinDescent);
+	if (hori && os2) {
+		int hori_height = hori->Ascender - hori->Descender;
+		int os2_height = os2->usWinAscent + os2->usWinDescent;
+		if (hori_height && os2_height)
+			mscale = (double)hori_height / os2_height;
+	}
 	memset(&rq, 0, sizeof(rq));
 	rq.type = FT_SIZE_REQUEST_TYPE_REAL_DIM;
 	rq.width = 0;



More information about the MPlayer-cvslog mailing list