src/hb-ft.cc | 10 +++++++++- src/hb-ot-layout-common-private.hh | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-)
New commits: commit 54b2b93722c9f067199cd7145dfd065d5b6b2f0c Author: Behdad Esfahbod <[email protected]> Date: Fri Jan 5 13:20:21 2018 +0000 [ot] Fix VariationStore evaluation algorithm Ouch! Missing coords should still be evaluated as coord=0, which most of the time results in a factor of 0. We were skipping these, which was equivalent to a factor of 1. Fixes https://github.com/harfbuzz/harfbuzz/issues/652 diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 78e65d38..cb308cd2 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -1275,10 +1275,11 @@ struct VarRegionList const VarRegionAxis *axes = axesZ + (region_index * axisCount); float v = 1.; - unsigned int count = MIN (coord_len, (unsigned int) axisCount); + unsigned int count = axisCount; for (unsigned int i = 0; i < count; i++) { - float factor = axes[i].evaluate (coords[i]); + int coord = i < coord_len ? coords[i] : 0; + float factor = axes[i].evaluate (coord); if (factor == 0.) return 0.; v *= factor; commit a3afdd1e080bb181ddec126b6233d52438882a13 Author: Behdad Esfahbod <[email protected]> Date: Fri Jan 5 13:17:02 2018 +0000 Minor diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 5e699e19..78e65d38 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -1394,7 +1394,7 @@ struct VariationStore protected: UINT16 format; LOffsetTo<VarRegionList> regions; - OffsetArrayOf<VarData, UINT32> dataSets; + OffsetArrayOf<VarData, UINT32> dataSets; public: DEFINE_SIZE_ARRAY (8, dataSets); }; commit cb43bdbc2f3a16061c33596b15b29eb7f9713871 Author: Behdad Esfahbod <[email protected]> Date: Fri Jan 5 13:06:25 2018 +0000 [ft] If there's no variations set, don't set them on hb-font diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 4f33e114..ae8c8d92 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -635,10 +635,18 @@ hb_ft_font_changed (hb_font_t *font) { if (!FT_Get_Var_Blend_Coordinates (ft_face, mm_var->num_axis, ft_coords)) { + bool nonzero = false; + for (unsigned int i = 0; i < mm_var->num_axis; ++i) + { coords[i] = ft_coords[i] >>= 2; + nonzero = nonzero || coords[i]; + } - hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis); + if (nonzero) + hb_font_set_var_coords_normalized (font, coords, mm_var->num_axis); + else + hb_font_set_var_coords_normalized (font, nullptr, 0); } } free (coords); _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
