From 4a9268f2807db09f3b6480b7a1deb544d99b6f87 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 11:00:02 -0700 Subject: [PATCH] [subset-plan] Simplify _glyphset allocation --- src/hb-subset-plan.cc | 11 +++++------ src/hb-subset-plan.hh | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 1d09983ec..e70ec7c6e 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -667,23 +667,23 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, * composite glyphs. */ if (glyf.has_data ()) for (hb_codepoint_t gid : cur_glyphset) - _glyf_add_gid_and_children (glyf, gid, plan->_glyphset, + _glyf_add_gid_and_children (glyf, gid, &plan->_glyphset, cur_glyphset.get_population () * HB_COMPOSITE_OPERATIONS_PER_GLYPH); else - plan->_glyphset->union_ (cur_glyphset); + plan->_glyphset.union_ (cur_glyphset); #ifndef HB_NO_SUBSET_CFF if (!plan->accelerator || plan->accelerator->has_seac) { bool has_seac = false; if (cff.is_valid ()) for (hb_codepoint_t gid : cur_glyphset) - if (_add_cff_seac_components (cff, gid, plan->_glyphset)) + if (_add_cff_seac_components (cff, gid, &plan->_glyphset)) has_seac = true; plan->has_seac = has_seac; } #endif - _remove_invalid_gids (plan->_glyphset, plan->source->get_num_glyphs ()); + _remove_invalid_gids (&plan->_glyphset, plan->source->get_num_glyphs ()); #ifndef HB_NO_VAR @@ -852,7 +852,6 @@ hb_subset_plan_create_or_fail (hb_face_t *face, plan->source = hb_face_reference (face); plan->dest = hb_face_builder_create (); - plan->_glyphset = hb_set_create (); plan->_glyphset_gsub = hb_set_create (); plan->_glyphset_mathed = hb_set_create (); plan->_glyphset_colred = hb_set_create (); @@ -929,7 +928,7 @@ hb_subset_plan_create_or_fail (hb_face_t *face, _create_old_gid_to_new_gid_map (face, input->flags & HB_SUBSET_FLAGS_RETAIN_GIDS, - plan->_glyphset, + &plan->_glyphset, plan->glyph_map, plan->reverse_glyph_map, &plan->_num_output_glyphs); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 432a4714d..40260b242 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -58,7 +58,6 @@ struct hb_subset_plan_t hb_map_destroy (glyph_map); hb_map_destroy (reverse_glyph_map); hb_map_destroy (glyph_map_gsub); - hb_set_destroy (_glyphset); hb_set_destroy (_glyphset_gsub); hb_set_destroy (_glyphset_mathed); hb_set_destroy (_glyphset_colred); @@ -143,7 +142,7 @@ struct hb_subset_plan_t hb_face_t *dest; unsigned int _num_output_glyphs; - hb_set_t *_glyphset; + hb_set_t _glyphset; hb_set_t *_glyphset_gsub; hb_set_t *_glyphset_mathed; hb_set_t *_glyphset_colred; @@ -246,7 +245,7 @@ struct hb_subset_plan_t inline const hb_set_t * glyphset () const { - return _glyphset; + return &_glyphset; } /* @@ -273,7 +272,7 @@ struct hb_subset_plan_t */ inline bool is_empty_glyph (hb_codepoint_t gid) const { - return !_glyphset->has (gid); + return !_glyphset.has (gid); } inline bool new_gid_for_codepoint (hb_codepoint_t codepoint,