[subset] Keep glyph set in plan

Should remove the vector version at some point...
This commit is contained in:
Behdad Esfahbod 2018-09-03 18:54:32 -07:00
parent dc50493a8d
commit 3f00d0b0df
2 changed files with 11 additions and 11 deletions

View File

@ -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, _populate_gids_to_retain (hb_face_t *face,
const hb_set_t *unicodes, const hb_set_t *unicodes,
bool close_over_gsub, bool close_over_gsub,
@ -117,9 +117,10 @@ _populate_gids_to_retain (hb_face_t *face,
while (all_gids_to_retain->next (&gid)) while (all_gids_to_retain->next (&gid))
glyphs->push (gid); glyphs->push (gid);
hb_set_destroy (all_gids_to_retain);
glyf.fini (); glyf.fini ();
cmap.fini (); cmap.fini ();
return all_gids_to_retain;
} }
static void static void
@ -155,13 +156,12 @@ hb_subset_plan_create (hb_face_t *face,
plan->dest = hb_face_builder_create (); plan->dest = hb_face_builder_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();
plan->glyphset = _populate_gids_to_retain (face,
_populate_gids_to_retain (face, input->unicodes,
input->unicodes, !plan->drop_layout,
!plan->drop_layout, plan->unicodes,
plan->unicodes, plan->codepoint_to_glyph,
plan->codepoint_to_glyph, &plan->glyphs);
&plan->glyphs);
_create_old_gid_to_new_gid_map (plan->glyphs, _create_old_gid_to_new_gid_map (plan->glyphs,
plan->glyph_map); plan->glyph_map);
@ -184,6 +184,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
hb_face_destroy (plan->dest); hb_face_destroy (plan->dest);
hb_map_destroy (plan->codepoint_to_glyph); hb_map_destroy (plan->codepoint_to_glyph);
hb_map_destroy (plan->glyph_map); hb_map_destroy (plan->glyph_map);
hb_set_destroy (plan->glyphset);
free (plan); free (plan);
} }

View File

@ -45,9 +45,8 @@ struct hb_subset_plan_t
// For each cp that we'd like to retain maps to the corresponding gid. // For each cp that we'd like to retain maps to the corresponding gid.
hb_set_t *unicodes; 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<hb_codepoint_t> glyphs; hb_vector_t<hb_codepoint_t> glyphs;
hb_set_t *glyphset;
hb_map_t *codepoint_to_glyph; hb_map_t *codepoint_to_glyph;
hb_map_t *glyph_map; hb_map_t *glyph_map;