|
|
|
@ -30,7 +30,68 @@ |
|
|
|
|
/* Unit tests for HVAR subsetting */ |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_HVAR_noop (void) |
|
|
|
|
test_subset_map_HVAR_noop (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file("fonts/AdobeVFPrototype.abc.otf"); |
|
|
|
|
|
|
|
|
|
hb_set_t *codepoints = hb_set_create (); |
|
|
|
|
hb_face_t *face_abc_subset; |
|
|
|
|
hb_set_add (codepoints, 'a'); |
|
|
|
|
hb_set_add (codepoints, 'b'); |
|
|
|
|
hb_set_add (codepoints, 'c'); |
|
|
|
|
face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints)); |
|
|
|
|
hb_set_destroy (codepoints); |
|
|
|
|
|
|
|
|
|
hb_subset_test_check (face_abc, face_abc_subset, HB_TAG ('H','V','A','R')); |
|
|
|
|
|
|
|
|
|
hb_face_destroy (face_abc_subset); |
|
|
|
|
hb_face_destroy (face_abc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_map_HVAR (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file ("fonts/AdobeVFPrototype.abc.otf"); |
|
|
|
|
hb_face_t *face_ac = hb_test_open_font_file ("fonts/AdobeVFPrototype.ac.otf"); |
|
|
|
|
|
|
|
|
|
hb_set_t *codepoints = hb_set_create (); |
|
|
|
|
hb_face_t *face_abc_subset; |
|
|
|
|
hb_set_add (codepoints, 'a'); |
|
|
|
|
hb_set_add (codepoints, 'c'); |
|
|
|
|
face_abc_subset = hb_subset_test_create_subset (face_abc, hb_subset_test_create_input (codepoints)); |
|
|
|
|
hb_set_destroy (codepoints); |
|
|
|
|
|
|
|
|
|
hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('H','V','A','R')); |
|
|
|
|
|
|
|
|
|
hb_face_destroy (face_abc_subset); |
|
|
|
|
hb_face_destroy (face_abc); |
|
|
|
|
hb_face_destroy (face_ac); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_map_HVAR_retaingids (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file ("fonts/AdobeVFPrototype.abc.otf"); |
|
|
|
|
hb_face_t *face_ac = hb_test_open_font_file ("fonts/AdobeVFPrototype.ac.retaingids.otf"); |
|
|
|
|
|
|
|
|
|
hb_set_t *codepoints = hb_set_create (); |
|
|
|
|
hb_face_t *face_abc_subset; |
|
|
|
|
hb_set_add (codepoints, 'a'); |
|
|
|
|
hb_set_add (codepoints, 'c'); |
|
|
|
|
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 ('H','V','A','R')); |
|
|
|
|
|
|
|
|
|
hb_face_destroy (face_abc_subset); |
|
|
|
|
hb_face_destroy (face_abc); |
|
|
|
|
hb_face_destroy (face_ac); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_identity_HVAR_noop (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file("fonts/SourceSansVariable-Roman.abc.ttf"); |
|
|
|
|
|
|
|
|
@ -49,7 +110,7 @@ test_subset_HVAR_noop (void) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_HVAR (void) |
|
|
|
|
test_subset_identity_HVAR (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.abc.ttf"); |
|
|
|
|
hb_face_t *face_ac = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.ac.ttf"); |
|
|
|
@ -69,7 +130,7 @@ test_subset_HVAR (void) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
test_subset_HVAR_retaingids (void) |
|
|
|
|
test_subset_identity_HVAR_retaingids (void) |
|
|
|
|
{ |
|
|
|
|
hb_face_t *face_abc = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.abc.ttf"); |
|
|
|
|
hb_face_t *face_ac = hb_test_open_font_file ("fonts/SourceSansVariable-Roman.ac.retaingids.ttf"); |
|
|
|
@ -96,9 +157,12 @@ main (int argc, char **argv) |
|
|
|
|
{ |
|
|
|
|
hb_test_init (&argc, &argv); |
|
|
|
|
|
|
|
|
|
hb_test_add (test_subset_HVAR_noop); |
|
|
|
|
hb_test_add (test_subset_HVAR); |
|
|
|
|
hb_test_add (test_subset_HVAR_retaingids); |
|
|
|
|
hb_test_add (test_subset_map_HVAR_noop); |
|
|
|
|
hb_test_add (test_subset_map_HVAR); |
|
|
|
|
hb_test_add (test_subset_map_HVAR_retaingids); |
|
|
|
|
hb_test_add (test_subset_identity_HVAR_noop); |
|
|
|
|
hb_test_add (test_subset_identity_HVAR); |
|
|
|
|
hb_test_add (test_subset_identity_HVAR_retaingids); |
|
|
|
|
|
|
|
|
|
return hb_test_run (); |
|
|
|
|
} |
|
|
|
|