[aat] Support ranges in NonContextual subtable as well

This commit is contained in:
Behdad Esfahbod 2023-01-10 10:53:21 -07:00
parent c08308a83c
commit 2c9c49fd32
2 changed files with 17 additions and 1 deletions

View File

@ -803,7 +803,6 @@ struct StateTableDriver
last_range = range; last_range = range;
} }
if (!(range->flags & ac->subtable_flags)) if (!(range->flags & ac->subtable_flags))
{ {
if (buffer->idx == buffer->len || unlikely (!buffer->successful)) if (buffer->idx == buffer->len || unlikely (!buffer->successful))

View File

@ -618,8 +618,25 @@ struct NoncontextualSubtable
hb_glyph_info_t *info = c->buffer->info; hb_glyph_info_t *info = c->buffer->info;
unsigned int count = c->buffer->len; unsigned int count = c->buffer->len;
auto *last_range = c->range_flags && (*c->range_flags) ? &(*c->range_flags)[0] : nullptr;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if (last_range)
{
auto *range = last_range;
{
unsigned cluster = info[i].cluster;
while (cluster < range->cluster_first)
range--;
while (cluster > range->cluster_last)
range++;
last_range = range;
}
if (!(range->flags & c->subtable_flags))
continue;
}
const HBGlyphID16 *replacement = substitute.get_value (info[i].codepoint, num_glyphs); const HBGlyphID16 *replacement = substitute.get_value (info[i].codepoint, num_glyphs);
if (replacement) if (replacement)
{ {