From 7b8a8adb7d3d273e16ad5933b1a958f4d13a6572 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 18 Feb 2021 09:47:24 -0700 Subject: [PATCH] [aat] Fix unsafe-to-break marking when end-of-text action kicks in The state we are dealing with here is the previous state; so it should cause unsafe_to_break before current glyph. I'm surprised this wasn't caught by any tests. Guess we don't have any fonts with fancy end-of-text forms. --- src/hb-aat-layout-common.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 0f5815c22..9431dfa45 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -766,11 +766,11 @@ struct StateTableDriver } /* Unsafe-to-break if end-of-text would kick in here. */ - if (buffer->idx + 2 <= buffer->len) + if (buffer->backtrack_len () && buffer->idx < buffer->len) { const Entry &end_entry = machine.get_entry (state, StateTable::CLASS_END_OF_TEXT); if (c->is_actionable (this, end_entry)) - buffer->unsafe_to_break (buffer->idx, buffer->idx + 2); + buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1); } c->transition (this, entry);