diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index 639a7e5c1c1b2f4dbbd716e45ffbad6af44b128f..f05b10c84a1e9ee71fb93e38e20f7378e58218e7 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -140,11 +140,14 @@ struct CFF2CSInterpEnv : CSInterpEnv inline void process_vsindex (void) { - if (do_blend) + unsigned int index; + if (likely (argStack.check_pop_uint (index))) { - unsigned int index; - if (likely (!seen_vsindex && !seen_blend && argStack.check_pop_uint (index))) - set_ivs (argStack.check_pop_uint (index)); + if (do_blend) + { + if (likely (!seen_vsindex && !seen_blend)) + set_ivs (index); + } } seen_vsindex = true; } @@ -236,7 +239,6 @@ struct CFF2CSOpSet : CSOpSet static inline void process_vsindex (CFF2CSInterpEnv &env, PARAM& param) { env.process_vsindex (); - OPSET::flush_args_and_op (OpCode_vsindexcs, env, param, env.argStack.get_count ()-1); } private: diff --git a/test/api/fonts/AdobeVFPrototype_vsindex.otf b/test/api/fonts/AdobeVFPrototype_vsindex.otf new file mode 100644 index 0000000000000000000000000000000000000000..3697b46c124cf364cb25afe73e9e5235b5c50892 Binary files /dev/null and b/test/api/fonts/AdobeVFPrototype_vsindex.otf differ diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c index 244faa8f6e7dd316fb9c93ca73c3fddd3645c252..9099465863cebb150c4d78252fe70a400129fdbf 100644 --- a/test/api/test-ot-extents-cff.c +++ b/test/api/test-ot-extents-cff.c @@ -106,6 +106,38 @@ test_extents_cff2 (void) hb_font_destroy (font); } +static void +test_extents_cff2_vsindex (void) +{ + hb_face_t *face = hb_subset_test_open_font ("fonts/AdobeVFPrototype_vsindex.otf"); + g_assert (face); + hb_font_t *font = hb_font_create (face); + hb_face_destroy (face); + g_assert (font); + hb_ot_font_set_funcs (font); + + hb_glyph_extents_t extents; + float coords[2] = { 800.0f, 50.0f }; + hb_font_set_var_coords_design (font, coords, 2); + bool result = hb_font_get_glyph_extents (font, 1, &extents); + g_assert (result); + + g_assert_cmpint (extents.x_bearing, ==, 11); + g_assert_cmpint (extents.y_bearing, ==, 656); + g_assert_cmpint (extents.width, ==, 653); + g_assert_cmpint (extents.height, ==, -656); + + result = hb_font_get_glyph_extents (font, 2, &extents); + g_assert (result); + + g_assert_cmpint (extents.x_bearing, ==, 7); + g_assert_cmpint (extents.y_bearing, ==, 669); + g_assert_cmpint (extents.width, ==, 650); + g_assert_cmpint (extents.height, ==, -669); + + hb_font_destroy (font); +} + int main (int argc, char **argv) { @@ -114,6 +146,7 @@ main (int argc, char **argv) hb_test_add (test_extents_cff1); hb_test_add (test_extents_cff1_legacyops); hb_test_add (test_extents_cff2); + hb_test_add (test_extents_cff2_vsindex); return hb_test_run (); }