[subset-plan] Simplify gsub/gpos_feature_substitutes_map allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 11:12:07 -07:00
parent 01208c7c02
commit 9e24873c1e
3 changed files with 6 additions and 11 deletions

View File

@ -159,7 +159,7 @@ struct hb_subset_layout_context_t :
lookup_index_map = &c_->plan->gsub_lookups; lookup_index_map = &c_->plan->gsub_lookups;
script_langsys_map = &c_->plan->gsub_langsys; script_langsys_map = &c_->plan->gsub_langsys;
feature_index_map = &c_->plan->gsub_features; feature_index_map = &c_->plan->gsub_features;
feature_substitutes_map = c_->plan->gsub_feature_substitutes_map; feature_substitutes_map = &c_->plan->gsub_feature_substitutes_map;
feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gsub_feature_record_cond_idx_map; feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gsub_feature_record_cond_idx_map;
} }
else else
@ -167,7 +167,7 @@ struct hb_subset_layout_context_t :
lookup_index_map = &c_->plan->gpos_lookups; lookup_index_map = &c_->plan->gpos_lookups;
script_langsys_map = &c_->plan->gpos_langsys; script_langsys_map = &c_->plan->gpos_langsys;
feature_index_map = &c_->plan->gpos_features; feature_index_map = &c_->plan->gpos_features;
feature_substitutes_map = c_->plan->gpos_feature_substitutes_map; feature_substitutes_map = &c_->plan->gpos_feature_substitutes_map;
feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gpos_feature_record_cond_idx_map; feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gpos_feature_record_cond_idx_map;
} }
} }

View File

@ -633,7 +633,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
&plan->gsub_features, &plan->gsub_features,
&plan->gsub_langsys, &plan->gsub_langsys,
&plan->gsub_feature_record_cond_idx_map, &plan->gsub_feature_record_cond_idx_map,
plan->gsub_feature_substitutes_map); &plan->gsub_feature_substitutes_map);
if (!drop_tables->has (HB_OT_TAG_GPOS)) if (!drop_tables->has (HB_OT_TAG_GPOS))
_closure_glyphs_lookups_features<GPOS> ( _closure_glyphs_lookups_features<GPOS> (
@ -643,7 +643,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
&plan->gpos_features, &plan->gpos_features,
&plan->gpos_langsys, &plan->gpos_langsys,
&plan->gpos_feature_record_cond_idx_map, &plan->gpos_feature_record_cond_idx_map,
plan->gpos_feature_substitutes_map); &plan->gpos_feature_substitutes_map);
#endif #endif
_remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ()); _remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ());
@ -857,9 +857,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
plan->reverse_glyph_map = hb_map_create (); plan->reverse_glyph_map = hb_map_create ();
plan->glyph_map_gsub = hb_map_create (); plan->glyph_map_gsub = hb_map_create ();
plan->check_success (plan->gsub_feature_substitutes_map = hb_hashmap_create<unsigned, const OT::Feature*> ());
plan->check_success (plan->gpos_feature_substitutes_map = hb_hashmap_create<unsigned, const OT::Feature*> ());
plan->colrv1_layers = hb_map_create (); plan->colrv1_layers = hb_map_create ();
plan->colr_palettes = hb_map_create (); plan->colr_palettes = hb_map_create ();
plan->check_success (plan->layout_variation_idx_delta_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ()); plan->check_success (plan->layout_variation_idx_delta_map = hb_hashmap_create<unsigned, hb_pair_t<unsigned, int>> ());

View File

@ -63,8 +63,6 @@ struct hb_subset_plan_t
hb_map_destroy (axes_index_map); hb_map_destroy (axes_index_map);
hb_map_destroy (axes_old_index_tag_map); hb_map_destroy (axes_old_index_tag_map);
hb_hashmap_destroy (gsub_feature_substitutes_map);
hb_hashmap_destroy (gpos_feature_substitutes_map);
hb_hashmap_destroy (axes_location); hb_hashmap_destroy (axes_location);
hb_hashmap_destroy (sanitized_table_cache); hb_hashmap_destroy (sanitized_table_cache);
hb_hashmap_destroy (hmtx_map); hb_hashmap_destroy (hmtx_map);
@ -158,8 +156,8 @@ struct hb_subset_plan_t
//feature index-> address of substituation feature table mapping with //feature index-> address of substituation feature table mapping with
//variations //variations
hb_hashmap_t<unsigned, const OT::Feature*> *gsub_feature_substitutes_map; hb_hashmap_t<unsigned, const OT::Feature*> gsub_feature_substitutes_map;
hb_hashmap_t<unsigned, const OT::Feature*> *gpos_feature_substitutes_map; hb_hashmap_t<unsigned, const OT::Feature*> gpos_feature_substitutes_map;
//active layers/palettes we'd like to retain //active layers/palettes we'd like to retain
hb_map_t *colrv1_layers; hb_map_t *colrv1_layers;