[subset/cff1] Micro-optimize

This commit is contained in:
Behdad Esfahbod 2023-06-26 22:51:50 -06:00
parent 40a1c08f4c
commit aed215639a
2 changed files with 3 additions and 3 deletions

View file

@ -330,7 +330,7 @@ struct Charset0
{
mapping->resize (num_glyphs, false);
for (hb_codepoint_t gid = 1; gid < num_glyphs; gid++)
mapping->arrayZ[gid] = {sids[gid - 1], gid + 1};
mapping->arrayZ[gid] = {sids[gid - 1], gid};
}
hb_codepoint_t get_glyph (hb_codepoint_t sid, unsigned int num_glyphs) const
@ -438,7 +438,7 @@ struct Charset1_2 {
unsigned count = ranges[i].nLeft + 1;
unsigned last = gid + count;
for (unsigned j = 0; j < count; j++)
mapping->arrayZ[gid++] = {sid++, last};
mapping->arrayZ[gid++] = {sid++, last - 1};
if (gid >= num_glyphs)
break;

View file

@ -557,7 +557,7 @@ struct cff1_subset_plan
if (glyph == old_glyph && skip)
{
glyph = hb_min (_.first - 1, glyph_to_sid_map->arrayZ[old_glyph].glyph - 1);
glyph = hb_min (_.first - 1, glyph_to_sid_map->arrayZ[old_glyph].glyph);
sid += glyph - old_glyph;
}
}