From eda02c2ebd6527f9072e3488ef8c675e4d85a720 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Mon, 5 Dec 2022 20:18:41 +0000 Subject: [PATCH] [subset] Move hb_subset_preprocess to be non-experimental. --- perf/benchmark-subset.cc | 4 ---- src/gen-def.py | 1 - src/hb-subset-input.cc | 6 ++---- src/hb-subset.h | 7 +++---- test/subset/run-tests.py | 11 ++++++++--- util/hb-subset.cc | 4 ---- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/perf/benchmark-subset.cc b/perf/benchmark-subset.cc index 237dbe480..28ad93c6b 100644 --- a/perf/benchmark-subset.cc +++ b/perf/benchmark-subset.cc @@ -106,13 +106,9 @@ void AddGlyphs(unsigned num_glyphs_in_font, // the subsetting operations. static hb_face_t* preprocess_face(hb_face_t* face) { - #ifdef HB_EXPERIMENTAL_API hb_face_t* new_face = hb_subset_preprocess(face); hb_face_destroy(face); return new_face; - #else - return face; - #endif } /* benchmark for subsetting a font */ diff --git a/src/gen-def.py b/src/gen-def.py index f6b98bfd2..857102d7c 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -22,7 +22,6 @@ if '--experimental-api' not in sys.argv: """hb_subset_repack_or_fail hb_subset_input_pin_axis_location hb_subset_input_pin_axis_to_default -hb_subset_preprocess hb_subset_input_override_name_table """.splitlines () symbols = [x for x in symbols if x not in experimental_symbols] diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc index 5165a7904..d210a8e79 100644 --- a/src/hb-subset-input.cc +++ b/src/hb-subset-input.cc @@ -448,16 +448,15 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input, #endif #endif -#ifdef HB_EXPERIMENTAL_API /** * hb_subset_preprocess * @input: a #hb_face_t object. * * Preprocesses the face and attaches data that will be needed by the * subsetter. Future subsetting operations can then use the precomputed data - * to speed up the subsetting operation. + * to speed up the subsetting operation. Returns a new hb_face_t*. * - * Since: EXPERIMENTAL + * Since: REPLACEME **/ HB_EXTERN hb_face_t * @@ -514,7 +513,6 @@ hb_subset_preprocess (hb_face_t *source) return new_source; } -#endif #ifdef HB_EXPERIMENTAL_API /** diff --git a/src/hb-subset.h b/src/hb-subset.h index ac05ecd6f..ffffd6ad9 100644 --- a/src/hb-subset.h +++ b/src/hb-subset.h @@ -181,10 +181,6 @@ hb_subset_input_pin_axis_location (hb_subset_input_t *input, #endif #ifdef HB_EXPERIMENTAL_API - -HB_EXTERN hb_face_t * -hb_subset_preprocess (hb_face_t *source); - HB_EXTERN hb_bool_t hb_subset_input_override_name_table (hb_subset_input_t *input, hb_ot_name_id_t name_id, @@ -196,6 +192,9 @@ hb_subset_input_override_name_table (hb_subset_input_t *input, #endif +HB_EXTERN hb_face_t * +hb_subset_preprocess (hb_face_t *source); + HB_EXTERN hb_face_t * hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input); diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index 6a2146dbe..db3c042a1 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -47,14 +47,16 @@ def fail_test (test, cli_args, message): print (' expected_file %s' % os.path.abspath (expected_file)) return 1 -def run_test (test, should_check_ots): +def run_test (test, should_check_ots, preprocess): out_file = os.path.join (tempfile.mkdtemp (), test.get_font_name () + '-subset' + test.get_font_extension ()) cli_args = ["--font-file=" + test.font_path, "--output-file=" + out_file, "--unicodes=%s" % test.unicodes (), - "--preprocess-face", "--drop-tables+=DSIG", "--drop-tables-=sbix"] + if preprocess: + cli_args.extend(["--preprocess-face",]) + cli_args.extend (test.get_profile_flags ()) if test.get_instance_flags (): cli_args.extend (["--instance=%s" % ','.join(test.get_instance_flags ())]) @@ -142,7 +144,10 @@ for path in args: print ("Running tests in " + path) test_suite = SubsetTestSuite (path, f.read ()) for test in test_suite.tests (): - fails += run_test (test, has_ots) + # Tests are run with and without preprocessing, results should be the + # same between them. + fails += run_test (test, has_ots, False) + fails += run_test (test, has_ots, True) if fails != 0: sys.exit ("%d test(s) failed." % fails) diff --git a/util/hb-subset.cc b/util/hb-subset.cc index 0c545ddc5..e02cff8d8 100644 --- a/util/hb-subset.cc +++ b/util/hb-subset.cc @@ -34,11 +34,7 @@ static hb_face_t* preprocess_face(hb_face_t* face) { - #ifdef HB_EXPERIMENTAL_API return hb_subset_preprocess (face); - #else - return hb_face_reference(face); - #endif } /*