From efafe7aa3bef6d4367ca10caefb24802f809b299 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 Jan 2023 11:03:19 -0700 Subject: [PATCH] [subset-plan] Simplify _glyphset_mathed allocation --- src/hb-ot-math-table.hh | 10 +++++----- src/hb-subset-plan.cc | 9 ++++----- src/hb-subset-plan.hh | 3 +-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh index 93953370e..dccf720f4 100644 --- a/src/hb-ot-math-table.hh +++ b/src/hb-ot-math-table.hh @@ -201,7 +201,7 @@ struct MathItalicsCorrectionInfo bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - const hb_set_t &glyphset = *c->plan->_glyphset_mathed; + const hb_set_t &glyphset = c->plan->_glyphset_mathed; const hb_map_t &glyph_map = *c->plan->glyph_map; auto *out = c->serializer->start_embed (*this); @@ -254,7 +254,7 @@ struct MathTopAccentAttachment bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - const hb_set_t &glyphset = *c->plan->_glyphset_mathed; + const hb_set_t &glyphset = c->plan->_glyphset_mathed; const hb_map_t &glyph_map = *c->plan->glyph_map; auto *out = c->serializer->start_embed (*this); @@ -486,7 +486,7 @@ struct MathKernInfo bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - const hb_set_t &glyphset = *c->plan->_glyphset_mathed; + const hb_set_t &glyphset = c->plan->_glyphset_mathed; const hb_map_t &glyph_map = *c->plan->glyph_map; auto *out = c->serializer->start_embed (*this); @@ -567,7 +567,7 @@ struct MathGlyphInfo out->mathItalicsCorrectionInfo.serialize_subset (c, mathItalicsCorrectionInfo, this); out->mathTopAccentAttachment.serialize_subset (c, mathTopAccentAttachment, this); - const hb_set_t &glyphset = *c->plan->_glyphset_mathed; + const hb_set_t &glyphset = c->plan->_glyphset_mathed; const hb_map_t &glyph_map = *c->plan->glyph_map; auto it = @@ -938,7 +938,7 @@ struct MathVariants bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - const hb_set_t &glyphset = *c->plan->_glyphset_mathed; + const hb_set_t &glyphset = c->plan->_glyphset_mathed; const hb_map_t &glyph_map = *c->plan->glyph_map; auto *out = c->serializer->start_embed (*this); diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index ac05f0a7c..40077be2f 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -647,14 +647,14 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, #endif _remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ()); - hb_set_set (plan->_glyphset_mathed, &plan->_glyphset_gsub); + plan->_glyphset_mathed = plan->_glyphset_gsub; if (!drop_tables->has (HB_OT_TAG_MATH)) { - _math_closure (plan, plan->_glyphset_mathed); - _remove_invalid_gids (plan->_glyphset_mathed, plan->source->get_num_glyphs ()); + _math_closure (plan, &plan->_glyphset_mathed); + _remove_invalid_gids (&plan->_glyphset_mathed, plan->source->get_num_glyphs ()); } - hb_set_t cur_glyphset = *plan->_glyphset_mathed; + hb_set_t cur_glyphset = plan->_glyphset_mathed; if (!drop_tables->has (HB_OT_TAG_COLR)) { _colr_closure (plan->source, plan->colrv1_layers, plan->colr_palettes, &cur_glyphset); @@ -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_mathed = hb_set_create (); plan->_glyphset_colred = hb_set_create (); plan->codepoint_to_glyph = hb_map_create (); plan->glyph_map = hb_map_create (); diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 23138b709..be4d481aa 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_mathed); hb_set_destroy (_glyphset_colred); hb_map_destroy (colrv1_layers); hb_map_destroy (colr_palettes); @@ -143,7 +142,7 @@ struct hb_subset_plan_t unsigned int _num_output_glyphs; hb_set_t _glyphset; hb_set_t _glyphset_gsub; - hb_set_t *_glyphset_mathed; + hb_set_t _glyphset_mathed; hb_set_t *_glyphset_colred; //active lookups we'd like to retain