shithub: freetype+ttf2subf

Download patch

ref: 5e094c6fb2ddd6e8901a5679e2cbb8fa476a38ee
parent: a25ecfddbad6d6e5a534bf0374f4f522349fc158
author: Werner Lemberg <[email protected]>
date: Mon Jun 10 10:59:21 EDT 2013

[truetype] Improve handling of broken sbit advance widths.

* src/truetype/ttgload.c (TT_Load_Glyph): Use the glyph's (scaled)
`linearHoriAdvance' if the sbit's `horiAdvance' value is zero.

Cf. font `Fixedsys Excelsior' v3.01 (FSEX300.ttf), glyph A, 16ppem.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2013-06-10  Werner Lemberg  <[email protected]>
 
+	[truetype] Improve handling of broken sbit advance widths.
+
+	* src/truetype/ttgload.c (TT_Load_Glyph): Use the glyph's (scaled)
+	`linearHoriAdvance' if the sbit's `horiAdvance' value is zero.
+
+	Cf. font `Fixedsys Excelsior' v3.01 (FSEX300.ttf), glyph A, 16ppem.
+
+2013-06-10  Werner Lemberg  <[email protected]>
+
 	[sfnt] Improve embedded bitmap tracing.
 
 	* src/base/ftobjs.c (FT_Request_Size): Move trace message regarding
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2224,6 +2224,13 @@
           glyph->linearHoriAdvance = loader.linear;
           glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax -
                                        loader.vadvance;
+
+          /* sanity check: if `horiAdvance' in the sbit metric */
+          /* structure isn't set, use `linearHoriAdvance'      */
+          if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
+            glyph->metrics.horiAdvance =
+              FT_MulFix( glyph->linearHoriAdvance,
+                         size->root.metrics.x_scale );
         }
 
         return FT_Err_Ok;