diff options
Diffstat (limited to 'thirdparty/harfbuzz/src/hb-subset-input.cc')
-rw-r--r-- | thirdparty/harfbuzz/src/hb-subset-input.cc | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/thirdparty/harfbuzz/src/hb-subset-input.cc b/thirdparty/harfbuzz/src/hb-subset-input.cc index 14ae210d49..fd250104bb 100644 --- a/thirdparty/harfbuzz/src/hb-subset-input.cc +++ b/thirdparty/harfbuzz/src/hb-subset-input.cc @@ -49,7 +49,7 @@ hb_subset_input_create_or_fail (void) set = hb_set_create (); input->axes_location = hb_hashmap_create<hb_tag_t, float> (); - + if (!input->axes_location || input->in_error ()) { hb_subset_input_destroy (input); @@ -89,7 +89,6 @@ hb_subset_input_create_or_fail (void) hb_tag_t default_no_subset_tables[] = { HB_TAG ('a', 'v', 'a', 'r'), - HB_TAG ('f', 'v', 'a', 'r'), HB_TAG ('g', 'a', 's', 'p'), HB_TAG ('c', 'v', 't', ' '), HB_TAG ('f', 'p', 'g', 'm'), @@ -393,7 +392,7 @@ hb_subset_input_get_user_data (const hb_subset_input_t *input, * * Since: EXPERIMENTAL **/ -hb_bool_t +HB_EXTERN hb_bool_t hb_subset_input_pin_axis_to_default (hb_subset_input_t *input, hb_face_t *face, hb_tag_t axis_tag) @@ -417,7 +416,7 @@ hb_subset_input_pin_axis_to_default (hb_subset_input_t *input, * * Since: EXPERIMENTAL **/ -hb_bool_t +HB_EXTERN hb_bool_t hb_subset_input_pin_axis_location (hb_subset_input_t *input, hb_face_t *face, hb_tag_t axis_tag, @@ -432,3 +431,51 @@ 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. + * + * Since: EXPERIMENTAL + **/ + +HB_EXTERN hb_face_t * +hb_subset_preprocess (hb_face_t *source) +{ + hb_subset_input_t* input = hb_subset_input_create_or_fail (); + + hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); + hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE)); + + hb_set_clear (hb_subset_input_set(input, + HB_SUBSET_SETS_LAYOUT_FEATURE_TAG)); + hb_set_invert (hb_subset_input_set(input, + HB_SUBSET_SETS_LAYOUT_FEATURE_TAG)); + + hb_set_clear (hb_subset_input_set(input, + HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG)); + hb_set_invert (hb_subset_input_set(input, + HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG)); + + hb_set_clear (hb_subset_input_set(input, + HB_SUBSET_SETS_NAME_ID)); + hb_set_invert (hb_subset_input_set(input, + HB_SUBSET_SETS_NAME_ID)); + + hb_subset_input_set_flags(input, + HB_SUBSET_FLAGS_NOTDEF_OUTLINE | + HB_SUBSET_FLAGS_GLYPH_NAMES | + HB_SUBSET_FLAGS_RETAIN_GIDS); + input->attach_accelerator_data = true; + + hb_face_t* new_source = hb_subset_or_fail (source, input); + hb_subset_input_destroy (input); + + return new_source; +} +#endif |