update arguments in_populate_gids_to_retain() and _create_old_gid_to_new_gid_map()

so they don't use deprecated variable
This commit is contained in:
Qunxin Liu 2019-03-26 09:15:56 -07:00 committed by Garret Rieger
parent 79a6c25849
commit 3147133b61
1 changed files with 18 additions and 18 deletions

View File

@ -99,8 +99,7 @@ _populate_gids_to_retain (hb_face_t *face,
const hb_set_t *input_glyphs_to_retain, const hb_set_t *input_glyphs_to_retain,
bool close_over_gsub, bool close_over_gsub,
hb_set_t *unicodes_to_retain, hb_set_t *unicodes_to_retain,
hb_map_t *codepoint_to_glyph, hb_map_t *codepoint_to_glyph)
hb_vector_t<hb_codepoint_t> *glyphs)
{ {
OT::cmap::accelerator_t cmap; OT::cmap::accelerator_t cmap;
OT::glyf::accelerator_t glyf; OT::glyf::accelerator_t glyf;
@ -145,10 +144,10 @@ _populate_gids_to_retain (hb_face_t *face,
_remove_invalid_gids (all_gids_to_retain, face->get_num_glyphs ()); _remove_invalid_gids (all_gids_to_retain, face->get_num_glyphs ());
glyphs->alloc (all_gids_to_retain->get_population ()); //glyphs->alloc (all_gids_to_retain->get_population ());
gid = HB_SET_VALUE_INVALID; //gid = HB_SET_VALUE_INVALID;
while (all_gids_to_retain->next (&gid)) //while (all_gids_to_retain->next (&gid))
glyphs->push (gid); //glyphs->push (gid);
cff.fini (); cff.fini ();
glyf.fini (); glyf.fini ();
@ -160,26 +159,29 @@ _populate_gids_to_retain (hb_face_t *face,
static void static void
_create_old_gid_to_new_gid_map (const hb_face_t *face, _create_old_gid_to_new_gid_map (const hb_face_t *face,
bool retain_gids, bool retain_gids,
const hb_vector_t<hb_codepoint_t> &glyphs, hb_set_t *all_gids_to_retain,
hb_map_t *glyph_map, /* OUT */ hb_map_t *glyph_map, /* OUT */
hb_map_t *reverse_glyph_map, /* OUT */ hb_map_t *reverse_glyph_map, /* OUT */
unsigned int *num_glyphs /* OUT */) unsigned int *num_glyphs /* OUT */)
{ {
for (unsigned int i = 0; i < glyphs.length; i++) { hb_codepoint_t gid = HB_SET_VALUE_INVALID;
unsigned int length = 0;
for (unsigned int i = 0; all_gids_to_retain->next (&gid); i++) {
if (!retain_gids) if (!retain_gids)
{ {
glyph_map->set (glyphs[i], i); glyph_map->set (gid, i);
reverse_glyph_map->set (i, glyphs[i]); reverse_glyph_map->set (i, gid);
} }
else else
{ {
glyph_map->set (glyphs[i], glyphs[i]); glyph_map->set (gid, gid);
reverse_glyph_map->set (glyphs[i], glyphs[i]); reverse_glyph_map->set (gid, gid);
} }
++length;
} }
if (!retain_gids || glyphs.length == 0) if (!retain_gids || length == 0)
{ {
*num_glyphs = glyphs.length; *num_glyphs = length;
} }
else else
{ {
@ -213,18 +215,16 @@ hb_subset_plan_create (hb_face_t *face,
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->reverse_glyph_map = hb_map_create(); plan->reverse_glyph_map = hb_map_create();
hb_vector_t<hb_codepoint_t> glyphs;
plan->_glyphset = _populate_gids_to_retain (face, plan->_glyphset = _populate_gids_to_retain (face,
input->unicodes, input->unicodes,
input->glyphs, input->glyphs,
!plan->drop_layout, !plan->drop_layout,
plan->unicodes, plan->unicodes,
plan->codepoint_to_glyph, plan->codepoint_to_glyph);
&glyphs);
_create_old_gid_to_new_gid_map (face, _create_old_gid_to_new_gid_map (face,
input->retain_gids, input->retain_gids,
glyphs, plan->_glyphset,
plan->glyph_map, plan->glyph_map,
plan->reverse_glyph_map, plan->reverse_glyph_map,
&plan->_num_output_glyphs); &plan->_num_output_glyphs);