From 05aa084e67705285941c9acd13151e2a38da8b0f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 24 Nov 2022 12:13:31 -0700 Subject: [PATCH] [PairPos] Another attempt at fixing unsafe-to-break with ValueFormat2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116 Test: $ hb-shape XBRoya34.ttf ' الأ' --show-flags --script=arab --- src/OT/Layout/GPOS/PairPosFormat2.hh | 9 +++++---- src/OT/Layout/GPOS/PairSet.hh | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/OT/Layout/GPOS/PairPosFormat2.hh b/src/OT/Layout/GPOS/PairPosFormat2.hh index 1bb0d60ae..523e0e936 100644 --- a/src/OT/Layout/GPOS/PairPosFormat2.hh +++ b/src/OT/Layout/GPOS/PairPosFormat2.hh @@ -241,15 +241,16 @@ struct PairPosFormat2_4 boring: buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1); - - buffer->idx = skippy_iter.idx; if (len2) { - buffer->idx++; + skippy_iter.idx++; // https://github.com/harfbuzz/harfbuzz/issues/3824 - buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1); + // https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116 + buffer->unsafe_to_break (buffer->idx, skippy_iter.idx + 1); } + buffer->idx = skippy_iter.idx; + return_trace (true); } diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh index b1d9f83bc..2ad1f004c 100644 --- a/src/OT/Layout/GPOS/PairSet.hh +++ b/src/OT/Layout/GPOS/PairSet.hh @@ -132,8 +132,9 @@ struct PairSet if (len2) { pos++; - // https://github.com/harfbuzz/harfbuzz/issues/3824 - buffer->unsafe_to_break (pos - 1, pos + 1); + // https://github.com/harfbuzz/harfbuzz/issues/3824 + // https://github.com/harfbuzz/harfbuzz/issues/3888#issuecomment-1326781116 + buffer->unsafe_to_break (buffer->idx, pos + 1); } buffer->idx = pos;