[ot-glyph] Add a test for #2053

This commit is contained in:
Ebrahim Byagowi 2020-01-23 20:27:21 +03:30
parent f7187e90d2
commit 5532374f61
3 changed files with 28 additions and 0 deletions

View File

@ -3,3 +3,5 @@ cmap-format12-only files created by ttx & remove all other cmap entries
Inconsolata-Regular.abc.widerc.ttf has the hmtx width of "c" set to 600; everything else is 500. Subsetting out c should reduce numberOfHMetrics to 1.
chromacheck-* fonts are from https://github.com/RoelN/ChromaCheck/tree/master/fonts and licensed under MIT by Roel Nieskens and Google.
RanaKufi-Regular.subset.otf is from https://github.com/alif-type/rana-kufi/ but the subset is licensed for us in MIT for the project use.

Binary file not shown.

View File

@ -158,6 +158,31 @@ test_hb_ot_glyph_cff1 (void)
hb_font_destroy (font);
}
static void
test_hb_ot_glyph_cff1_rline (void)
{
/* https://github.com/harfbuzz/harfbuzz/pull/2053 */
hb_face_t *face = hb_test_open_font_file ("fonts/RanaKufi-Regular.subset.otf");
hb_font_t *font = hb_font_create (face);
hb_face_destroy (face);
char str[1024] = {0};
user_data_t user_data = {
.str = str,
.size = sizeof (str),
.consumed = 0
};
g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data));
char expected[] = "M775,400C705,400 650,343 650,274L650,250L391,250L713,572L392,893"
"L287,1000C311,942 296,869 250,823C250,823 286,858 321,823L571,572"
"L150,150L750,150L750,276C750,289 761,300 775,300C789,300 800,289 800,276"
"L800,100L150,100C100,100 100,150 100,150C100,85 58,23 0,0L900,0L900,274"
"C900,343 844,400 775,400Z";
g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1);
hb_font_destroy (font);
}
static void
test_hb_ot_glyph_cff2 (void)
{
@ -215,6 +240,7 @@ main (int argc, char **argv)
hb_test_add (test_hb_ot_glyph_empty);
hb_test_add (test_hb_ot_glyph_glyf);
hb_test_add (test_hb_ot_glyph_cff1);
hb_test_add (test_hb_ot_glyph_cff1_rline);
hb_test_add (test_hb_ot_glyph_cff2);
unsigned result = hb_test_run ();