From: Michiharu Ariza Date: Wed, 26 Sep 2018 23:30:26 +0000 (-0700) Subject: Added CFF1 J font subset to api test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dac70f252a84e1a255375eaacffc2cb3f3fc6e58;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Added CFF1 J font subset to api test Also fixed FDSelect3_4::get_fd Fixed test_subset_cff1_strip_hints (wrong font names!) --- diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index 3bebf3b..b036ae5 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -576,7 +576,7 @@ struct FDSelect3_4 { if (glyph < ranges[i].first) 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 (ranges[nRanges - 1]); } diff --git a/test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf b/test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf new file mode 100644 index 0000000..f433ced Binary files /dev/null and b/test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf differ diff --git a/test/api/fonts/SourceHanSans-Regular.41,4E9D.otf b/test/api/fonts/SourceHanSans-Regular.41,4E9D.otf new file mode 100644 index 0000000..3fe907e Binary files /dev/null and b/test/api/fonts/SourceHanSans-Regular.41,4E9D.otf differ diff --git a/test/api/test-subset-cff1.c b/test/api/test-subset-cff1.c index 62ce802..ae32c43 100644 --- a/test/api/test-subset-cff1.c +++ b/test/api/test-subset-cff1.c @@ -71,8 +71,8 @@ test_subset_cff1 (void) static 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_ac = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.ac.nohints.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.otf"); hb_set_t *codepoints = hb_set_create (); hb_subset_input_t *input; @@ -91,6 +91,26 @@ test_subset_cff1_strip_hints (void) 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 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); hb_test_add (test_subset_cff1_strip_hints); + hb_test_add (test_subset_cff1_j); return hb_test_run (); }