Revert "[subset/cff1] Micro-optimize"

This reverts commit 93020621f0651920ff92e19f543fbf2351c8311b.

This slowed down the common path actually.
This commit is contained in:
Behdad Esfahbod 2023-06-04 16:04:29 -06:00
parent f102d57a52
commit 072c9c06e0

View file

@ -396,28 +396,30 @@ struct Charset1_2 {
{
if (unlikely (glyph >= num_glyphs)) return 0;
unsigned i;
hb_codepoint_t orig_glyph = glyph;
hb_codepoint_t start_glyph;
if (cache && likely (cache->glyph <= glyph))
{
i = cache->code;
glyph -= cache->glyph;
start_glyph = cache->glyph;
}
else
{
if (unlikely (glyph == 0)) return 0;
i = 0;
glyph -= 1;
start_glyph = 1;
}
glyph -= start_glyph;
for (;; i++)
{
unsigned count = ranges[i].nLeft;
if (glyph <= count)
{
if (cache)
*cache = {i, orig_glyph - glyph};
*cache = {i, start_glyph};
return ranges[i].first + glyph;
}
count++;
start_glyph += count;
glyph -= count;
}