[subset-plan] Simplify name_table_overrides allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 12:38:26 -07:00
parent 65d3db375c
commit 4e7c803969
3 changed files with 6 additions and 11 deletions

View File

@ -391,7 +391,7 @@ struct name
#ifdef HB_EXPERIMENTAL_API
const hb_hashmap_t<hb_ot_name_record_ids_t, hb_bytes_t> *name_table_overrides =
c->plan->name_table_overrides;
&c->plan->name_table_overrides;
#endif
auto it =

View File

@ -863,8 +863,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
plan->pinned_at_default = true;
#ifdef HB_EXPERIMENTAL_API
plan->check_success (plan->name_table_overrides = hb_hashmap_create<hb_ot_name_record_ids_t, hb_bytes_t> ());
if (plan->name_table_overrides && input->name_table_overrides)
if (input->name_table_overrides)
{
for (auto _ : *input->name_table_overrides)
{
@ -875,7 +874,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face,
break;
hb_memcpy (name_str, name_bytes.arrayZ, len);
plan->name_table_overrides->set (_.first, hb_bytes_t (name_str, len));
plan->name_table_overrides.set (_.first, hb_bytes_t (name_str, len));
}
}
#endif

View File

@ -56,12 +56,8 @@ struct hb_subset_plan_t
hb_map_destroy (reverse_glyph_map);
#ifdef HB_EXPERIMENTAL_API
if (name_table_overrides)
{
for (auto _ : *name_table_overrides)
_.second.fini ();
}
hb_hashmap_destroy (name_table_overrides);
for (auto _ : name_table_overrides)
_.second.fini ();
#endif
if (inprogress_accelerator)
@ -171,7 +167,7 @@ struct hb_subset_plan_t
#ifdef HB_EXPERIMENTAL_API
// name table overrides map: hb_ot_name_record_ids_t-> name string new value or
// None to indicate should remove
hb_hashmap_t<hb_ot_name_record_ids_t, hb_bytes_t> *name_table_overrides;
hb_hashmap_t<hb_ot_name_record_ids_t, hb_bytes_t> name_table_overrides;
#endif
const hb_subset_accelerator_t* accelerator;