[subset-plan] Simplify _glyphset_mathed allocation

This commit is contained in:
Behdad Esfahbod 2023-01-11 11:03:19 -07:00
parent 113a1700df
commit efafe7aa3b
3 changed files with 10 additions and 12 deletions

View File

@ -201,7 +201,7 @@ struct MathItalicsCorrectionInfo
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
TRACE_SUBSET (this); 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; const hb_map_t &glyph_map = *c->plan->glyph_map;
auto *out = c->serializer->start_embed (*this); auto *out = c->serializer->start_embed (*this);
@ -254,7 +254,7 @@ struct MathTopAccentAttachment
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
TRACE_SUBSET (this); 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; const hb_map_t &glyph_map = *c->plan->glyph_map;
auto *out = c->serializer->start_embed (*this); auto *out = c->serializer->start_embed (*this);
@ -486,7 +486,7 @@ struct MathKernInfo
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
TRACE_SUBSET (this); 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; const hb_map_t &glyph_map = *c->plan->glyph_map;
auto *out = c->serializer->start_embed (*this); auto *out = c->serializer->start_embed (*this);
@ -567,7 +567,7 @@ struct MathGlyphInfo
out->mathItalicsCorrectionInfo.serialize_subset (c, mathItalicsCorrectionInfo, this); out->mathItalicsCorrectionInfo.serialize_subset (c, mathItalicsCorrectionInfo, this);
out->mathTopAccentAttachment.serialize_subset (c, mathTopAccentAttachment, 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; const hb_map_t &glyph_map = *c->plan->glyph_map;
auto it = auto it =
@ -938,7 +938,7 @@ struct MathVariants
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
TRACE_SUBSET (this); 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; const hb_map_t &glyph_map = *c->plan->glyph_map;
auto *out = c->serializer->start_embed (*this); auto *out = c->serializer->start_embed (*this);

View File

@ -647,14 +647,14 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
#endif #endif
_remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ()); _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)) if (!drop_tables->has (HB_OT_TAG_MATH))
{ {
_math_closure (plan, plan->_glyphset_mathed); _math_closure (plan, &plan->_glyphset_mathed);
_remove_invalid_gids (plan->_glyphset_mathed, plan->source->get_num_glyphs ()); _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)) if (!drop_tables->has (HB_OT_TAG_COLR))
{ {
_colr_closure (plan->source, plan->colrv1_layers, plan->colr_palettes, &cur_glyphset); _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->source = hb_face_reference (face);
plan->dest = hb_face_builder_create (); plan->dest = hb_face_builder_create ();
plan->_glyphset_mathed = hb_set_create ();
plan->_glyphset_colred = hb_set_create (); plan->_glyphset_colred = hb_set_create ();
plan->codepoint_to_glyph = hb_map_create (); plan->codepoint_to_glyph = hb_map_create ();
plan->glyph_map = hb_map_create (); plan->glyph_map = hb_map_create ();

View File

@ -58,7 +58,6 @@ struct hb_subset_plan_t
hb_map_destroy (glyph_map); hb_map_destroy (glyph_map);
hb_map_destroy (reverse_glyph_map); hb_map_destroy (reverse_glyph_map);
hb_map_destroy (glyph_map_gsub); hb_map_destroy (glyph_map_gsub);
hb_set_destroy (_glyphset_mathed);
hb_set_destroy (_glyphset_colred); hb_set_destroy (_glyphset_colred);
hb_map_destroy (colrv1_layers); hb_map_destroy (colrv1_layers);
hb_map_destroy (colr_palettes); hb_map_destroy (colr_palettes);
@ -143,7 +142,7 @@ struct hb_subset_plan_t
unsigned int _num_output_glyphs; unsigned int _num_output_glyphs;
hb_set_t _glyphset; hb_set_t _glyphset;
hb_set_t _glyphset_gsub; hb_set_t _glyphset_gsub;
hb_set_t *_glyphset_mathed; hb_set_t _glyphset_mathed;
hb_set_t *_glyphset_colred; hb_set_t *_glyphset_colred;
//active lookups we'd like to retain //active lookups we'd like to retain