[subset] Add test cases for gsub closure in subsetting.

This commit is contained in:
Garret Rieger 2018-06-07 15:32:52 -07:00
parent 37eab27be3
commit 197cb18b22
4 changed files with 52 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -100,6 +100,56 @@ test_subset_glyf_with_components (void)
hb_face_destroy (face_components); hb_face_destroy (face_components);
} }
static void
test_subset_glyf_with_gsub (void)
{
hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf");
hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fi.ttf");
hb_set_t *codepoints = hb_set_create();
hb_set_add (codepoints, 102); // f
hb_set_add (codepoints, 105); // i
hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
hb_set_destroy (codepoints);
*hb_subset_input_drop_ot_layout (input) = false;
hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input);
hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f'));
hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a'));
check_maxp_num_glyphs(face_subset, 5, true);
hb_face_destroy (face_subset);
hb_face_destroy (face_fi);
hb_face_destroy (face_fil);
}
static void
test_subset_glyf_without_gsub (void)
{
hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf");
hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.nogsub.fi.ttf");
hb_set_t *codepoints = hb_set_create();
hb_set_add (codepoints, 102); // f
hb_set_add (codepoints, 105); // i
hb_subset_input_t *input = hb_subset_test_create_input (codepoints);
hb_set_destroy (codepoints);
*hb_subset_input_drop_ot_layout (input) = true;
hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input);
hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f'));
hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a'));
check_maxp_num_glyphs(face_subset, 3, true);
hb_face_destroy (face_subset);
hb_face_destroy (face_fi);
hb_face_destroy (face_fil);
}
static void static void
test_subset_glyf_noop (void) test_subset_glyf_noop (void)
{ {
@ -213,6 +263,8 @@ main (int argc, char **argv)
hb_test_add (test_subset_glyf_strip_hints_composite); hb_test_add (test_subset_glyf_strip_hints_composite);
hb_test_add (test_subset_glyf_strip_hints_invalid); hb_test_add (test_subset_glyf_strip_hints_invalid);
hb_test_add (test_subset_glyf_with_components); hb_test_add (test_subset_glyf_with_components);
hb_test_add (test_subset_glyf_with_gsub);
hb_test_add (test_subset_glyf_without_gsub);
return hb_test_run(); return hb_test_run();
} }