Added CFF1 J font subset to api test

Also fixed FDSelect3_4::get_fd
Fixed test_subset_cff1_strip_hints (wrong font names!)
This commit is contained in:
Michiharu Ariza 2018-09-26 16:30:26 -07:00
parent ae7f0e83d4
commit dac70f252a
4 changed files with 24 additions and 3 deletions

View File

@ -576,7 +576,7 @@ struct FDSelect3_4 {
if (glyph < ranges[i].first) if (glyph < ranges[i].first)
return (hb_codepoint_t)ranges[i - 1].fd; return (hb_codepoint_t)ranges[i - 1].fd;
assert (false); return (hb_codepoint_t)ranges[nRanges - 1].fd;
} }
inline GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); } inline GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }

Binary file not shown.

Binary file not shown.

View File

@ -71,8 +71,8 @@ test_subset_cff1 (void)
static void static void
test_subset_cff1_strip_hints (void) test_subset_cff1_strip_hints (void)
{ {
hb_face_t *face_abc = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.abc.ttf"); hb_face_t *face_abc = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.abc.otf");
hb_face_t *face_ac = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.ac.nohints.ttf"); hb_face_t *face_ac = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.ac.nohints.otf");
hb_set_t *codepoints = hb_set_create (); hb_set_t *codepoints = hb_set_create ();
hb_subset_input_t *input; hb_subset_input_t *input;
@ -91,6 +91,26 @@ test_subset_cff1_strip_hints (void)
hb_face_destroy (face_ac); hb_face_destroy (face_ac);
} }
static void
test_subset_cff1_j (void)
{
hb_face_t *face_41_3041_4e9d = hb_subset_test_open_font ("fonts/SourceHanSans-Regular.41,3041,4E9D.otf");
hb_face_t *face_41_4e9d = hb_subset_test_open_font ("fonts/SourceHanSans-Regular.41,4E9D.otf");
hb_set_t *codepoints = hb_set_create ();
hb_face_t *face_41_3041_4e9d_subset;
hb_set_add (codepoints, 0x41);
hb_set_add (codepoints, 0x4E9D);
face_41_3041_4e9d_subset = hb_subset_test_create_subset (face_41_3041_4e9d, hb_subset_test_create_input (codepoints));
hb_set_destroy (codepoints);
hb_subset_test_check (face_41_4e9d, face_41_3041_4e9d_subset, HB_TAG ('C','F','F',' '));
hb_face_destroy (face_41_3041_4e9d_subset);
hb_face_destroy (face_41_3041_4e9d);
hb_face_destroy (face_41_4e9d);
}
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -99,6 +119,7 @@ main (int argc, char **argv)
hb_test_add (test_subset_cff1_noop); hb_test_add (test_subset_cff1_noop);
hb_test_add (test_subset_cff1); hb_test_add (test_subset_cff1);
hb_test_add (test_subset_cff1_strip_hints); hb_test_add (test_subset_cff1_strip_hints);
hb_test_add (test_subset_cff1_j);
return hb_test_run (); return hb_test_run ();
} }