[subset] Move hb_subset_preprocess to be non-experimental.

This commit is contained in:
Garret Rieger 2022-12-05 20:18:41 +00:00
parent 76d5482a7c
commit eda02c2ebd
6 changed files with 13 additions and 20 deletions

View File

@ -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 */

View File

@ -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]

View File

@ -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
/**

View File

@ -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);

View File

@ -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)

View File

@ -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
}
/*