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