From 3f00d0b0df14d69859b15568ff28a810d08f59ea Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 3 Sep 2018 18:54:32 -0700 Subject: [PATCH] [subset] Keep glyph set in plan Should remove the vector version at some point... --- src/hb-subset-plan.cc | 19 ++++++++++--------- src/hb-subset-plan.hh | 3 +-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index d9d25b3..0570060 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -68,7 +68,7 @@ _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) } -static void +static hb_set_t * _populate_gids_to_retain (hb_face_t *face, const hb_set_t *unicodes, bool close_over_gsub, @@ -117,9 +117,10 @@ _populate_gids_to_retain (hb_face_t *face, while (all_gids_to_retain->next (&gid)) glyphs->push (gid); - hb_set_destroy (all_gids_to_retain); glyf.fini (); cmap.fini (); + + return all_gids_to_retain; } static void @@ -155,13 +156,12 @@ hb_subset_plan_create (hb_face_t *face, plan->dest = hb_face_builder_create (); plan->codepoint_to_glyph = hb_map_create(); plan->glyph_map = hb_map_create(); - - _populate_gids_to_retain (face, - input->unicodes, - !plan->drop_layout, - plan->unicodes, - plan->codepoint_to_glyph, - &plan->glyphs); + plan->glyphset = _populate_gids_to_retain (face, + input->unicodes, + !plan->drop_layout, + plan->unicodes, + plan->codepoint_to_glyph, + &plan->glyphs); _create_old_gid_to_new_gid_map (plan->glyphs, plan->glyph_map); @@ -184,6 +184,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan) hb_face_destroy (plan->dest); hb_map_destroy (plan->codepoint_to_glyph); hb_map_destroy (plan->glyph_map); + hb_set_destroy (plan->glyphset); free (plan); } diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index 7b6bc77..c2c484a 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -45,9 +45,8 @@ struct hb_subset_plan_t // For each cp that we'd like to retain maps to the corresponding gid. hb_set_t *unicodes; - // This list contains the complete set of glyphs to retain and may contain - // more glyphs then the lists above. hb_vector_t glyphs; + hb_set_t *glyphset; hb_map_t *codepoint_to_glyph; hb_map_t *glyph_map; -- 2.7.4