[subset-plan] Simplify layout_scripts allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 10:40:54 -07:00
parent 5f51dd276b
commit 4de66eec57
3 changed files with 5 additions and 6 deletions

View File

@ -1145,7 +1145,7 @@ struct Script
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
if (!l->visitScript ()) return_trace (false); if (!l->visitScript ()) return_trace (false);
if (tag && !c->plan->layout_scripts->has (*tag)) if (tag && !c->plan->layout_scripts.has (*tag))
return false; return false;
auto *out = c->serializer->start_embed (*this); auto *out = c->serializer->start_embed (*this);

View File

@ -145,7 +145,7 @@ static void _collect_layout_indices (hb_subset_plan_t *plan,
hb_vector_t<hb_tag_t> scripts; hb_vector_t<hb_tag_t> scripts;
if (!plan->check_success (scripts.resize (num_scripts))) return; if (!plan->check_success (scripts.resize (num_scripts))) return;
table.get_script_tags (0, &num_scripts, scripts.arrayZ); table.get_script_tags (0, &num_scripts, scripts.arrayZ);
bool retain_all_scripts = !_filter_tag_list (&scripts, plan->layout_scripts); bool retain_all_scripts = !_filter_tag_list (&scripts, &plan->layout_scripts);
if (!plan->check_success (!features.in_error ()) || !features if (!plan->check_success (!features.in_error ()) || !features
|| !plan->check_success (!scripts.in_error ()) || !scripts) || !plan->check_success (!scripts.in_error ()) || !scripts)
@ -301,7 +301,7 @@ _closure_glyphs_lookups_features (hb_subset_plan_t *plan,
_GSUBGPOS_find_duplicate_features (*table, lookups, &feature_indices, feature_substitutes_map, &duplicate_feature_map); _GSUBGPOS_find_duplicate_features (*table, lookups, &feature_indices, feature_substitutes_map, &duplicate_feature_map);
feature_indices.clear (); feature_indices.clear ();
table->prune_langsys (&duplicate_feature_map, plan->layout_scripts, 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 ();
@ -845,7 +845,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
plan->name_ids = hb_set_copy (input->sets.name_ids); plan->name_ids = hb_set_copy (input->sets.name_ids);
plan->name_languages = hb_set_copy (input->sets.name_languages); plan->name_languages = hb_set_copy (input->sets.name_languages);
plan->layout_features = hb_set_copy (input->sets.layout_features); plan->layout_features = hb_set_copy (input->sets.layout_features);
plan->layout_scripts = hb_set_copy (input->sets.layout_scripts); plan->layout_scripts = *input->sets.layout_scripts;
plan->glyphs_requested = hb_set_copy (input->sets.glyphs); plan->glyphs_requested = hb_set_copy (input->sets.glyphs);
plan->drop_tables = hb_set_copy (input->sets.drop_tables); plan->drop_tables = hb_set_copy (input->sets.drop_tables);
plan->no_subset_tables = hb_set_copy (input->sets.no_subset_tables); plan->no_subset_tables = hb_set_copy (input->sets.no_subset_tables);

View File

@ -52,7 +52,6 @@ struct hb_subset_plan_t
hb_set_destroy (name_ids); hb_set_destroy (name_ids);
hb_set_destroy (name_languages); hb_set_destroy (name_languages);
hb_set_destroy (layout_features); hb_set_destroy (layout_features);
hb_set_destroy (layout_scripts);
hb_set_destroy (glyphs_requested); hb_set_destroy (glyphs_requested);
hb_set_destroy (drop_tables); hb_set_destroy (drop_tables);
hb_set_destroy (no_subset_tables); hb_set_destroy (no_subset_tables);
@ -127,7 +126,7 @@ struct hb_subset_plan_t
hb_set_t *layout_features; hb_set_t *layout_features;
// layout scripts which will be preserved. // layout scripts which will be preserved.
hb_set_t *layout_scripts; hb_set_t layout_scripts;
//glyph ids requested to retain //glyph ids requested to retain
hb_set_t *glyphs_requested; hb_set_t *glyphs_requested;