From 01208c7c02b779fb816391eb4a7ea6b76bd91cdc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 11:10:28 -0700 Subject: [PATCH] [subset-plan] Simplify gsub/gpos_feature_record_cond_idx_map allocation --- src/hb-ot-layout-common.hh | 4 ++-- src/hb-subset-plan.cc | 7 ++----- src/hb-subset-plan.hh | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 60d973329..28e548da5 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -160,7 +160,7 @@ struct hb_subset_layout_context_t : 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; + feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gsub_feature_record_cond_idx_map; } else { @@ -168,7 +168,7 @@ struct hb_subset_layout_context_t : 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; + feature_record_cond_idx_map = c_->plan->user_axes_location->is_empty () ? nullptr : &c_->plan->gpos_feature_record_cond_idx_map; } } diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 1afac8b66..72c8afe73 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -632,7 +632,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, &plan->gsub_lookups, &plan->gsub_features, &plan->gsub_langsys, - plan->gsub_feature_record_cond_idx_map, + &plan->gsub_feature_record_cond_idx_map, plan->gsub_feature_substitutes_map); if (!drop_tables->has (HB_OT_TAG_GPOS)) @@ -642,7 +642,7 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, &plan->gpos_lookups, &plan->gpos_features, &plan->gpos_langsys, - plan->gpos_feature_record_cond_idx_map, + &plan->gpos_feature_record_cond_idx_map, plan->gpos_feature_substitutes_map); #endif _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->glyph_map_gsub = hb_map_create (); - plan->check_success (plan->gsub_feature_record_cond_idx_map = hb_hashmap_create> ()); - plan->check_success (plan->gpos_feature_record_cond_idx_map = hb_hashmap_create> ()); - plan->check_success (plan->gsub_feature_substitutes_map = hb_hashmap_create ()); plan->check_success (plan->gpos_feature_substitutes_map = hb_hashmap_create ()); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index a3ddb30c1..76e267663 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -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_feature_record_cond_idx_map); - hb_hashmap_destroy (gpos_feature_record_cond_idx_map); hb_hashmap_destroy (gsub_feature_substitutes_map); hb_hashmap_destroy (gpos_feature_substitutes_map); hb_hashmap_destroy (axes_location); @@ -155,8 +153,8 @@ struct hb_subset_plan_t hb_map_t gpos_features; //active feature variation records/condition index with variations - hb_hashmap_t> *gsub_feature_record_cond_idx_map; - hb_hashmap_t> *gpos_feature_record_cond_idx_map; + hb_hashmap_t> gsub_feature_record_cond_idx_map; + hb_hashmap_t> gpos_feature_record_cond_idx_map; //feature index-> address of substituation feature table mapping with //variations