[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/ChangeLog b/ChangeLog
index d9edc2a..9968449 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2013-06-10 Werner Lemberg <wl@gnu.org>
+ [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 <wl@gnu.org>
+
[sfnt] Improve embedded bitmap tracing.
* src/base/ftobjs.c (FT_Request_Size): Move trace message regarding
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index bd2478b..f640a6c 100644
--- 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;