shithub: freetype+ttf2subf

Download patch

ref: e0469372be3870a5ad60b2c4586e9c281357bd28
parent: 7190098098f7e1021e9e0c5c4103c5f9f657813f
author: Werner Lemberg <[email protected]>
date: Tue Jan 22 06:07:07 EST 2013

[truetype] Fix font height.

* src/truetype/ttobjs.c (tt_size_reset): The Windows rendering
engine uses rounded values of the ascender and descender to compute
the TrueType font height.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-22  Werner Lemberg  <[email protected]>
+
+	[truetype] Fix font height.
+
+	* src/truetype/ttobjs.c (tt_size_reset): The Windows rendering
+	engine uses rounded values of the ascender and descender to compute
+	the TrueType font height.
+
 2013-01-16  Behdad Esfahbod  <[email protected]>
 
 	[sfnt] Fix optimized sbit loader.
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (body).                                              */
 /*                                                                         */
-/*  Copyright 1996-2012                                                    */
+/*  Copyright 1996-2013                                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -1177,11 +1177,12 @@
         FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );
       metrics->descender =
         FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );
-      metrics->height =
-        FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );
       metrics->max_advance =
         FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,
                                  metrics->x_scale ) );
+
+      /* the height is derived from rounded values */
+      metrics->height = metrics->ascender - metrics->descender;
     }
 
     /* compute new transformation */