From: Behdad Esfahbod Date: Sun, 4 Feb 2018 19:40:17 +0000 (-0500) Subject: [aat] In ContextualSubstitute, apply end-of-text action to last glyph X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8be596f0b76543e19644c0b77c1bcf4d9e783c2b;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [aat] In ContextualSubstitute, apply end-of-text action to last glyph --- diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index 68c32c4..ba9729c 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -219,15 +219,16 @@ struct ContextualSubtable ret = true; } } - if (entry->data.currentIndex != 0xFFFF && buffer->idx < buffer->len) + if (entry->data.currentIndex != 0xFFFF) { + unsigned int idx = MIN (buffer->idx, buffer->len - 1); const Lookup &lookup = subs[entry->data.currentIndex]; hb_glyph_info_t *info = buffer->info; - const GlyphID *replacement = lookup.get_value (info[buffer->idx].codepoint, driver->num_glyphs); + const GlyphID *replacement = lookup.get_value (info[idx].codepoint, driver->num_glyphs); if (replacement) { - buffer->unsafe_to_break (driver->last_zero, MIN (buffer->idx + 1, buffer->len)); - info[buffer->idx].codepoint = *replacement; + buffer->unsafe_to_break (driver->last_zero, idx + 1); + info[idx].codepoint = *replacement; ret = true; } }