[subset-plan] Simplify gsub_langsys and gpos_langsys allocation

pull/4027/head
Behdad Esfahbod 2 years ago
parent 5fc91de2c0
commit 06039db080
  1. 4
      src/hb-ot-layout-common.hh
  2. 7
      src/hb-subset-plan.cc
  3. 6
      src/hb-subset-plan.hh

@ -157,7 +157,7 @@ struct hb_subset_layout_context_t :
if (tag_ == HB_OT_TAG_GSUB)
{
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_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;
@ -165,7 +165,7 @@ struct hb_subset_layout_context_t :
else
{
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_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;

@ -631,7 +631,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
&plan->_glyphset_gsub,
&plan->gsub_lookups,
&plan->gsub_features,
plan->gsub_langsys,
&plan->gsub_langsys,
plan->gsub_feature_record_cond_idx_map,
plan->gsub_feature_substitutes_map);
@ -641,7 +641,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
&plan->_glyphset_gsub,
&plan->gpos_lookups,
&plan->gpos_features,
plan->gpos_langsys,
&plan->gpos_langsys,
plan->gpos_feature_record_cond_idx_map,
plan->gpos_feature_substitutes_map);
#endif
@ -857,9 +857,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
plan->reverse_glyph_map = hb_map_create ();
plan->glyph_map_gsub = hb_map_create ();
plan->check_success (plan->gsub_langsys = hb_hashmap_create<unsigned, hb::unique_ptr<hb_set_t>> ());
plan->check_success (plan->gpos_langsys = hb_hashmap_create<unsigned, hb::unique_ptr<hb_set_t>> ());
plan->check_success (plan->gsub_feature_record_cond_idx_map = hb_hashmap_create<unsigned, hb::shared_ptr<hb_set_t>> ());
plan->check_success (plan->gpos_feature_record_cond_idx_map = hb_hashmap_create<unsigned, hb::shared_ptr<hb_set_t>> ());

@ -63,8 +63,6 @@ struct hb_subset_plan_t
hb_map_destroy (axes_index_map);
hb_map_destroy (axes_old_index_tag_map);
hb_hashmap_destroy (gsub_langsys);
hb_hashmap_destroy (gpos_langsys);
hb_hashmap_destroy (gsub_feature_record_cond_idx_map);
hb_hashmap_destroy (gpos_feature_record_cond_idx_map);
hb_hashmap_destroy (gsub_feature_substitutes_map);
@ -149,8 +147,8 @@ struct hb_subset_plan_t
hb_map_t gpos_lookups;
//active langsys we'd like to retain
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *gsub_langsys;
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> *gpos_langsys;
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> gsub_langsys;
hb_hashmap_t<unsigned, hb::unique_ptr<hb_set_t>> gpos_langsys;
//active features after removing redundant langsys and prune_features
hb_map_t gsub_features;

Loading…
Cancel
Save