From 83c5298f33e66cfd3d84d246297683f0de80c57d Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Tue, 9 Oct 2018 21:59:36 -0700 Subject: [PATCH] added cff1_legacyops.otf as test-ot-extents-cff test case fixed roll operator bugs uncovered by the test --- src/hb-cff-interp-common.hh | 4 ++-- test/api/fonts/cff1_legacyops.otf | Bin 0 -> 3104 bytes test/api/test-ot-extents-cff.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/api/fonts/cff1_legacyops.otf diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index 266270cc7..52fc1ee43 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -603,13 +603,13 @@ struct ArgStack : Stack inline void reverse_range (int i, int j) { - assert (i >= 0 && i < j); + assert (i >= 0 && i <= j); ARG tmp; while (i < j) { tmp = S::elements[i]; S::elements[i++] = S::elements[j]; - S::elements[j++] = tmp; + S::elements[j--] = tmp; } } diff --git a/test/api/fonts/cff1_legacyops.otf b/test/api/fonts/cff1_legacyops.otf new file mode 100644 index 0000000000000000000000000000000000000000..ca50dab5aa3d39e5e7845efd40efdc7eeb59d581 GIT binary patch literal 3104 zcmbVOTWl0n82)EwcY8au&`?~YG$%nWH89;SElFD*C@qZ*O}BQ-MMUd#ce=Z2cV?ZL zr7bU#NTSd}yiy-bAVwb~@mYQHZhUIugOP*>qA|uNNlZ*o4E6hGW@%~g0y{b9{O7-& z|MH!aO^uDEsD{pvM(g_q2ITzhWSWTHCQ^P(rQ4DxzAV2>q<#e6bD5%1qAm0ukrv0k zKW`e@rlIk1$j@NEFAqlT+2|LLpTz#Le9@a#FVIuivpiBXW=o`ufYi=nidja{d}is~ zcI+33s-G{}uDARxC5Z&YBo&H8NKuqcX}j!X%(P*-BaXdi)XbHq4TmKi&B{yEth}r= zE9V4=^V$KS{dMB@$IaFDpC_YRkwsqv&;1*k=>QY&G*U!SqULu$CG}(?a4ZY1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mV?d00001 diff --git a/test/api/test-ot-extents-cff.c b/test/api/test-ot-extents-cff.c index 607a4d303..244faa8f6 100644 --- a/test/api/test-ot-extents-cff.c +++ b/test/api/test-ot-extents-cff.c @@ -52,6 +52,28 @@ test_extents_cff1 (void) hb_font_destroy (font); } +static void +test_extents_cff1_legacyops (void) +{ + hb_face_t *face = hb_subset_test_open_font ("fonts/cff1_legacyops.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; + hb_bool_t result = hb_font_get_glyph_extents (font, 0, &extents); + g_assert (result); + + g_assert_cmpint (extents.x_bearing, ==, 20); + g_assert_cmpint (extents.y_bearing, ==, 800); + g_assert_cmpint (extents.width, ==, 160); + g_assert_cmpint (extents.height, ==, -810); + + hb_font_destroy (font); +} + static void test_extents_cff2 (void) { @@ -90,6 +112,7 @@ main (int argc, char **argv) hb_test_init (&argc, &argv); hb_test_add (test_extents_cff1); + hb_test_add (test_extents_cff1_legacyops); hb_test_add (test_extents_cff2); return hb_test_run ();