[subset] Add unit test for glyf subsetting and retain gids.

This commit is contained in:
Garret Rieger 2019-01-18 17:36:32 -08:00
parent 96b038f375
commit ccc59dc612
2 changed files with 26 additions and 0 deletions

Binary file not shown.

View File

@ -257,6 +257,31 @@ test_subset_glyf_strip_hints_invalid (void)
hb_face_destroy (face);
}
static void
test_subset_glyf_retain_gids (void)
{
hb_face_t *face_abc = hb_test_open_font_file ("fonts/Roboto-Regular.abc.ttf");
hb_face_t *face_ac = hb_test_open_font_file ("fonts/Roboto-Regular.ac.retaingids.ttf");
hb_set_t *codepoints = hb_set_create();
hb_face_t *face_abc_subset;
hb_set_add (codepoints, 97);
hb_set_add (codepoints, 99);
hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
hb_subset_input_set_retain_gids (input, true);
face_abc_subset = hb_subset_test_create_subset (face_abc, input);
hb_set_destroy (codepoints);
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('l','o','c', 'a'));
check_maxp_num_glyphs(face_abc_subset, 4, true);
hb_face_destroy (face_abc_subset);
hb_face_destroy (face_abc);
hb_face_destroy (face_ac);
}
// TODO(grieger): test for long loca generation.
int
@ -272,6 +297,7 @@ main (int argc, char **argv)
hb_test_add (test_subset_glyf_with_components);
hb_test_add (test_subset_glyf_with_gsub);
hb_test_add (test_subset_glyf_without_gsub);
hb_test_add (test_subset_glyf_retain_gids);
return hb_test_run();
}