From f2dd8dcb815993b9e81d2cdfd61b8b73b28c7f9a Mon Sep 17 00:00:00 2001 From: Qunxin Liu Date: Mon, 15 Jun 2026 16:10:47 -0700 Subject: [PATCH] [subset] do math closure before gsub closure --- src/hb-subset-plan.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index b1325dd2e..0d75dc8ab 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -452,20 +452,20 @@ _populate_gids_to_retain (hb_subset_plan_t* plan, _cmap_closure (plan->source, &plan->unicodes, &plan->_glyphset_gsub); + if (!drop_tables->has (HB_OT_TAG_MATH)) + { + _math_closure (plan, &plan->_glyphset_gsub); + _remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ()); + } + plan->_glyphset_mathed = plan->_glyphset_gsub; + #ifndef HB_NO_SUBSET_LAYOUT layout_populate_gids_to_retain(plan, drop_tables); #endif _remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ()); - 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 ()); - } - - hb_set_t cur_glyphset = plan->_glyphset_mathed; + hb_set_t cur_glyphset = plan->_glyphset_gsub; if (!drop_tables->has (HB_OT_TAG_COLR)) { _colr_closure (plan, &cur_glyphset);