From 54b2b93722c9f067199cd7145dfd065d5b6b2f0c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 5 Jan 2018 13:20:21 +0000 Subject: [PATCH] [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 --- src/hb-ot-layout-common-private.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 78e65d389..cb308cd2c 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;