From 53059f92d6109cd427903ded1914bc2057ec78ae Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 Aug 2016 09:01:33 +0200 Subject: [PATCH] [sfnt] Fix `FT_Get_Advance' for bitmap strikes. `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the advance value from the font table and then scales it by the `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't set that value for bitmap fonts and the advance gets scaled to zero. Taken from https://github.com/behdad/harfbuzz/issues/252 * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) : Set scale values. --- ChangeLog | 18 +++++++++++++++++- src/sfnt/ttsbit.c | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 130c1ee6b..690fa2943 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,20 @@ -2016-07-16 Behdad Esfahbod +2016-08-06 Jon Spencer + + [sfnt] Fix `FT_Get_Advance' for bitmap strikes. + + `FT_Get_Advance' returns 0 for bitmap fonts. It first gets the + advance value from the font table and then scales it by the + `font->size->metrics->x_scale' field. But `FT_Select_Size' doesn't + set that value for bitmap fonts and the advance gets scaled to zero. + + Taken from + + https://github.com/behdad/harfbuzz/issues/252 + + * src/sfnt/ttsbit.c (tt_face_load_strike_metrics) + : Set scale values. + +2016-08-06 Behdad Esfahbod [truetype] Fix GX variation handling of composites. diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index e24e7d6cd..82c85446b 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -323,6 +323,16 @@ strike[18] + /* max_width */ (FT_Char)strike[23] /* min_advance_SB */ ) * 64; + + /* set the scale values (in 16.16 units) so advances */ + /* from the hmtx and vmtx table are scaled correctly */ + metrics->x_scale = FT_MulDiv( metrics->x_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + metrics->y_scale = FT_MulDiv( metrics->y_ppem, + 64 * 0x10000, + face->header.Units_Per_EM ); + return FT_Err_Ok; }