[subset] skip the script if it's not included in the final subset

This commit is contained in:
Qunxin Liu 2022-09-02 13:53:10 -07:00 committed by Behdad Esfahbod
parent e3548c2069
commit a3e6dbbb43
2 changed files with 4 additions and 1 deletions

View File

@ -4261,6 +4261,7 @@ struct GSUBGPOS
} }
void prune_langsys (const hb_map_t *duplicate_feature_map, void prune_langsys (const hb_map_t *duplicate_feature_map,
const hb_set_t *layout_scripts,
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map, hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *script_langsys_map,
hb_set_t *new_feature_indexes /* OUT */) const hb_set_t *new_feature_indexes /* OUT */) const
{ {
@ -4269,6 +4270,8 @@ struct GSUBGPOS
unsigned count = get_script_count (); unsigned count = get_script_count ();
for (unsigned script_index = 0; script_index < count; script_index++) for (unsigned script_index = 0; script_index < count; script_index++)
{ {
const Tag& tag = get_script_tag (script_index);
if (!layout_scripts->has (tag)) continue;
const Script& s = get_script (script_index); const Script& s = get_script (script_index);
s.prune_langsys (&c, script_index); s.prune_langsys (&c, script_index);
} }

View File

@ -259,7 +259,7 @@ _closure_glyphs_lookups_features (hb_subset_plan_t *plan,
_GSUBGPOS_find_duplicate_features (*table, lookups, &feature_indices, &duplicate_feature_map); _GSUBGPOS_find_duplicate_features (*table, lookups, &feature_indices, &duplicate_feature_map);
feature_indices.clear (); feature_indices.clear ();
table->prune_langsys (&duplicate_feature_map, langsys_map, &feature_indices); table->prune_langsys (&duplicate_feature_map, plan->layout_scripts, langsys_map, &feature_indices);
_remap_indexes (&feature_indices, features); _remap_indexes (&feature_indices, features);
table.destroy (); table.destroy ();