[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)
<TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
This commit is contained in:
Werner Lemberg 2016-08-07 09:01:33 +02:00
parent 8183eeb18d
commit 53059f92d6
2 changed files with 27 additions and 1 deletions

View File

@ -1,4 +1,20 @@
2016-07-16 Behdad Esfahbod <behdad@behdad.org>
2016-08-06 Jon Spencer <jon@jonspencer.ca>
[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)
<TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
2016-08-06 Behdad Esfahbod <behdad@behdad.org>
[truetype] Fix GX variation handling of composites.

View File

@ -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;
}