Update maxp to use the correct num glyphs.
}
maxp *maxp_prime = (maxp *) hb_blob_get_data (maxp_prime_blob, nullptr);
- maxp_prime->set_num_glyphs (plan->glyphs.length);
+ maxp_prime->set_num_glyphs (plan->num_glyphs);
if (plan->drop_hints)
drop_hint_fields (plan, maxp_prime);
hb_vector_t<unsigned int> *instruction_ranges /* OUT */)
{
unsigned int total = 0;
- hb_codepoint_t max_new_gid = 0;
for (unsigned int i = 0; i < plan->glyphs.length; i++)
{
hb_codepoint_t next_glyph = plan->glyphs[i];
- hb_codepoint_t new_gid_for_next_glyph;
- if (plan->new_gid_for_old_gid (next_glyph, &new_gid_for_next_glyph))
- max_new_gid = MAX (max_new_gid, new_gid_for_next_glyph);
unsigned int start_offset, end_offset;
if (unlikely (!(glyf.get_offsets (next_glyph, &start_offset, &end_offset) &&
*glyf_size = total;
loca_data->is_short = (total <= 131070);
- loca_data->size = (max_new_gid + 2)
+ loca_data->size = (plan->num_glyphs + 1)
* (loca_data->is_short ? sizeof (OT::HBUINT16) : sizeof (OT::HBUINT32));
DEBUG_MSG(SUBSET, nullptr, "preparing to subset glyf: final size %d, loca size %d, using %s loca",
}
static void
-_create_old_gid_to_new_gid_map (bool retain_gids,
+_create_old_gid_to_new_gid_map (bool retain_gids,
const hb_vector_t<hb_codepoint_t> &glyphs,
- hb_map_t *glyph_map)
+ hb_map_t *glyph_map, /* OUT */
+ unsigned int *num_glyphs /* OUT */)
{
for (unsigned int i = 0; i < glyphs.length; i++) {
if (!retain_gids)
else
glyph_map->set (glyphs[i], glyphs[i]);
}
+ if (!retain_gids || glyphs.length == 0)
+ {
+ *num_glyphs = glyphs.length;
+ }
+ else
+ {
+ *num_glyphs = glyphs[glyphs.length - 1] + 1;
+ }
}
/**
_create_old_gid_to_new_gid_map (input->retain_gids,
plan->glyphs,
- plan->glyph_map);
+ plan->glyph_map,
+ &plan->num_glyphs);
return plan;
}
hb_map_t *codepoint_to_glyph;
hb_map_t *glyph_map;
+ unsigned int num_glyphs;
// Plan is only good for a specific source/dest so keep them with it
hb_face_t *source;