]> granicus.if.org Git - libass/commitdiff
Tweak font metrics to match Windows GDI
authorGrigori Goronzy <greg@blackbox>
Thu, 16 Jul 2009 20:44:12 +0000 (22:44 +0200)
committerGrigori Goronzy <greg@blackbox>
Thu, 16 Jul 2009 22:21:51 +0000 (00:21 +0200)
Try to change ascender/descender calculation to be more compatible
with Windows GDI and consequently, VSFilter.

libass/ass_font.c

index 34ae292c466ceac7a4bfb36b9cc563d61765764d..35d34cf492f48acc103c0d090a690e6c9b3b9435 100644 (file)
@@ -268,8 +268,9 @@ void ass_font_get_asc_desc(ass_font_t *font, uint32_t ch, int *asc,
     for (i = 0; i < font->n_faces; ++i) {
         FT_Face face = font->faces[i];
         if (FT_Get_Char_Index(face, ch)) {
-            *asc = face->size->metrics.ascender;
-            *desc = -face->size->metrics.descender;
+            int y_scale = face->size->metrics.y_scale;
+            *asc = FT_MulFix(face->ascender, y_scale);
+            *desc = FT_MulFix(-face->descender, y_scale);
             return;
         }
     }