From 29c903223b31c30ad609a23c75a98231674c3a73 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Fri, 17 Apr 2020 22:11:40 +0430 Subject: [PATCH] Move hb_ot_layout_closure_{features,lookups} behind EXPERIMENTAL flag --- src/gen-def.py | 4 +++- src/hb-ot-layout.cc | 2 ++ src/hb-ot-layout.h | 2 ++ src/hb-subset-plan.cc | 6 ++++++ test/api/test-ot-face.c | 4 ++++ test/api/test-subset-gpos.c | 4 ++++ test/subset/data/Makefile.sources | 13 ++++++++----- test/subset/meson.build | 18 +++++++++--------- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/gen-def.py b/src/gen-def.py index f89582a8d..b852932f7 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -34,7 +34,9 @@ hb_draw_funcs_set_cubic_to_func hb_draw_funcs_set_line_to_func hb_draw_funcs_set_move_to_func hb_draw_funcs_set_quadratic_to_func -hb_font_get_var_coords_design""".splitlines () +hb_font_get_var_coords_design +hb_ot_layout_closure_lookups +hb_ot_layout_closure_features""".splitlines () symbols = [x for x in symbols if x not in experimental_symbols] symbols = "\n".join (symbols) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index bc285295b..1777dda5b 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1203,6 +1203,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face, g.feature_variation_collect_lookups (&feature_indexes, lookup_indexes); } +#ifdef HB_EXPERIMENTAL_API /** * hb_ot_layout_closure_lookups: * @face: #hb_face_t to work upon @@ -1266,6 +1267,7 @@ hb_ot_layout_closure_features (hb_face_t *face, const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); g.closure_features (lookup_indexes, feature_indexes); } +#endif #ifndef HB_NO_LAYOUT_COLLECT_GLYPHS diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h index 3625f91d9..0bd66166a 100644 --- a/src/hb-ot-layout.h +++ b/src/hb-ot-layout.h @@ -263,6 +263,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face, const hb_tag_t *features, hb_set_t *lookup_indexes /* OUT */); +#ifdef HB_EXPERIMENTAL_API HB_EXTERN void hb_ot_layout_closure_lookups (hb_face_t *face, hb_tag_t table_tag, @@ -274,6 +275,7 @@ hb_ot_layout_closure_features (hb_face_t *face, hb_tag_t table_tag, const hb_map_t *lookup_indexes, /* IN */ hb_set_t *feature_indexes /* OUT */); +#endif HB_EXTERN void hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 672b748bb..9e59be259 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -51,6 +51,7 @@ _add_cff_seac_components (const OT::cff1::accelerator_t &cff, #endif #ifndef HB_NO_SUBSET_LAYOUT +#ifdef HB_EXPERIMENTAL_API static void _remap_indexes (const hb_set_t *indexes, hb_map_t *mapping /* OUT */) @@ -61,6 +62,7 @@ _remap_indexes (const hb_set_t *indexes, mapping->set (_.first, _.second); } +#endif static inline void _gsub_closure_glyphs_lookups_features (hb_face_t *face, @@ -78,6 +80,7 @@ _gsub_closure_glyphs_lookups_features (hb_face_t *face, hb_ot_layout_lookups_substitute_closure (face, &lookup_indices, gids_to_retain); +#ifdef HB_EXPERIMENTAL_API hb_ot_layout_closure_lookups (face, HB_OT_TAG_GSUB, gids_to_retain, @@ -91,6 +94,7 @@ _gsub_closure_glyphs_lookups_features (hb_face_t *face, gsub_lookups, &feature_indices); _remap_indexes (&feature_indices, gsub_features); +#endif } static inline void @@ -106,6 +110,7 @@ _gpos_closure_lookups_features (hb_face_t *face, nullptr, nullptr, &lookup_indices); +#ifdef HB_EXPERIMENTAL_API hb_ot_layout_closure_lookups (face, HB_OT_TAG_GPOS, gids_to_retain, @@ -119,6 +124,7 @@ _gpos_closure_lookups_features (hb_face_t *face, gpos_lookups, &feature_indices); _remap_indexes (&feature_indices, gpos_features); +#endif } #endif diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index a857d5b9b..5eac868c5 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -75,12 +75,16 @@ test_font (hb_font_t *font, hb_codepoint_t cp) hb_set_t *lookup_indexes = hb_set_create (); hb_set_add (lookup_indexes, 0); +#ifdef HB_EXPERIMENTAL_API hb_ot_layout_closure_lookups (face, HB_OT_TAG_GSUB, set, lookup_indexes); +#endif hb_map_t *lookup_mapping = hb_map_create (); hb_map_set (lookup_mapping, 0, 0); hb_set_t *feature_indices = hb_set_create (); +#ifdef HB_EXPERIMENTAL_API hb_ot_layout_closure_features (face, HB_OT_TAG_GSUB, lookup_mapping, feature_indices); +#endif hb_set_destroy (lookup_indexes); hb_set_destroy (feature_indices); hb_map_destroy (lookup_mapping); diff --git a/test/api/test-subset-gpos.c b/test/api/test-subset-gpos.c index 5546bf27a..5c2fe2ed0 100644 --- a/test/api/test-subset-gpos.c +++ b/test/api/test-subset-gpos.c @@ -32,6 +32,7 @@ static void test_subset_gpos_lookup_subtable (void) { +#ifdef HB_EXPERIMENTAL_API hb_face_t *face_pwa = hb_test_open_font_file ("fonts/Roboto-Regular-gpos-.aw.ttf"); hb_face_t *face_wa = hb_test_open_font_file ("fonts/Roboto-Regular-gpos-aw.ttf"); @@ -52,12 +53,14 @@ test_subset_gpos_lookup_subtable (void) hb_face_destroy (face_pwa_subset); hb_face_destroy (face_pwa); hb_face_destroy (face_wa); +#endif } /* TODO: Once GDEF subsetting is implemented, this test may fail & expected result need update. */ static void test_subset_gpos_pairpos1_vf (void) { +#ifdef HB_EXPERIMENTAL_API hb_face_t *face_wav = hb_test_open_font_file ("fonts/AdobeVFPrototype.WAV.gpos.otf"); hb_face_t *face_wa = hb_test_open_font_file ("fonts/AdobeVFPrototype.WA.gpos.otf"); @@ -78,6 +81,7 @@ test_subset_gpos_pairpos1_vf (void) hb_face_destroy (face_wav_subset); hb_face_destroy (face_wav); hb_face_destroy (face_wa); +#endif } int diff --git a/test/subset/data/Makefile.sources b/test/subset/data/Makefile.sources index 597ab7e52..f50e6ae6b 100644 --- a/test/subset/data/Makefile.sources +++ b/test/subset/data/Makefile.sources @@ -4,6 +4,14 @@ TESTS = \ tests/cff-full-font.tests \ tests/japanese.tests \ tests/cff-japanese.tests \ + tests/cmap.tests \ + tests/cmap14.tests \ + tests/sbix.tests \ + tests/colr.tests \ + tests/cbdt.tests \ + $(NULL) + +DISABLED_TESTS = \ tests/layout.tests \ tests/layout.gpos.tests \ tests/layout.gpos2.tests \ @@ -13,11 +21,6 @@ TESTS = \ tests/layout.gsub3.tests \ tests/layout.gsub6.tests \ tests/layout.gdef.tests \ - tests/cmap.tests \ - tests/cmap14.tests \ - tests/sbix.tests \ - tests/colr.tests \ - tests/cbdt.tests \ $(NULL) XFAIL_TESTS = \ diff --git a/test/subset/meson.build b/test/subset/meson.build index ef30bd82a..35b6c0b8c 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -4,15 +4,15 @@ tests = [ 'cff-full-font', 'japanese', 'cff-japanese', - 'layout', - 'layout.gpos', - 'layout.gpos2', - 'layout.gpos3', - 'layout.gpos4', - 'layout.gpos6', - 'layout.gsub3', - 'layout.gsub6', - 'layout.gdef', + #'layout', + #'layout.gpos', + #'layout.gpos2', + #'layout.gpos3', + #'layout.gpos4', + #'layout.gpos6', + #'layout.gsub3', + #'layout.gsub6', + #'layout.gdef', 'cmap', 'cmap14', 'sbix',