summaryrefslogtreecommitdiff
path: root/external/harfbuzz/0001-PairPos-Another-attempt-at-fixing-unsafe-to-break-wi.patch.1
blob: 0fd429257b8da08eae2cfae4d19e21b643ba9f7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From 05aa084e67705285941c9acd13151e2a38da8b0f Mon Sep 17 00:00:00 2001
From: Behdad Esfahbod <behdad@behdad.org>
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;
-- 
2.38.1