added cff1_legacyops.otf as test-ot-extents-cff test case

fixed roll operator bugs uncovered by the test
This commit is contained in:
Michiharu Ariza 2018-10-09 21:59:36 -07:00
parent 588518ea51
commit 83c5298f33
3 changed files with 25 additions and 2 deletions

View File

@ -603,13 +603,13 @@ struct ArgStack : Stack<ARG, 513>
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;
}
}

Binary file not shown.

View File

@ -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 ();