[subset-input] Refactor copy-pasta code

This commit is contained in:
Behdad Esfahbod 2023-01-01 16:22:02 -07:00
parent 4adc748b13
commit 52110f13b0
1 changed files with 13 additions and 24 deletions

View File

@ -482,37 +482,26 @@ hb_subset_preprocess (hb_face_t *source)
if (!input)
return hb_face_reference (source);
hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_UNICODE));
const hb_subset_sets_t indices[] = {HB_SUBSET_SETS_UNICODE,
HB_SUBSET_SETS_GLYPH_INDEX,
HB_SUBSET_SETS_NAME_ID,
HB_SUBSET_SETS_NAME_LANG_ID,
HB_SUBSET_SETS_LAYOUT_FEATURE_TAG,
HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG};
hb_set_clear (hb_subset_input_set(input, HB_SUBSET_SETS_GLYPH_INDEX));
hb_set_invert (hb_subset_input_set(input, HB_SUBSET_SETS_GLYPH_INDEX));
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_set_clear (hb_subset_input_set(input,
HB_SUBSET_SETS_NAME_LANG_ID));
hb_set_invert (hb_subset_input_set(input,
HB_SUBSET_SETS_NAME_LANG_ID));
for (auto idx : hb_iter (indices))
{
hb_set_t *set = hb_subset_input_set (input, idx);
hb_set_clear (set);
hb_set_invert (set);
}
hb_subset_input_set_flags(input,
HB_SUBSET_FLAGS_NOTDEF_OUTLINE |
HB_SUBSET_FLAGS_GLYPH_NAMES |
HB_SUBSET_FLAGS_RETAIN_GIDS |
HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES);
input->attach_accelerator_data = true;
// Always use long loca in the preprocessed version. This allows