Skip to content

Commit f9e00a7

Browse files
Revert "Re-enable Unicode ZWJ handling code that had been disabled pending an ICU update (#4035)" (#4036)
This reverts commit afd2e6b. Fuchsia is still using an older version of ICU that does not support this. Also temporarily disable a unit test that failed without the reverted patch.
1 parent afd2e6b commit f9e00a7

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

third_party/txt/src/minikin/GraphemeBreak.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ bool GraphemeBreak::isGraphemeBreak(const float* advances,
112112
return false;
113113
}
114114
// Rule GB9, x (Extend | ZWJ); Rule GB9a, x SpacingMark; Rule GB9b, Prepend x
115-
if (p2 == U_GCB_EXTEND || p2 == U_GCB_ZWJ || p2 == U_GCB_SPACING_MARK ||
115+
// TODO(abarth): Add U_GCB_ZWJ once we update ICU.
116+
if (p2 == U_GCB_EXTEND || /* p2 == U_GCB_ZWJ || */ p2 == U_GCB_SPACING_MARK ||
116117
p1 == U_GCB_PREPEND) {
117118
return false;
118119
}
@@ -156,26 +157,25 @@ bool GraphemeBreak::isGraphemeBreak(const float* advances,
156157
}
157158
}
158159

160+
// TODO(abarth): Enablet his code once we update ICU.
159161
// Tailored version of Rule GB11, ZWJ × (Glue_After_Zwj | EBG)
160162
// We try to make emoji sequences with ZWJ a single grapheme cluster, but only
161163
// if they actually merge to one cluster. So we are more relaxed than the UAX
162164
// #29 rules in accepting any emoji character after the ZWJ, but are tighter
163165
// in that we only treat it as one cluster if a ligature is actually formed
164-
// and we also require the character before the ZWJ to also be an emoji.
165-
if (p1 == U_GCB_ZWJ && isEmoji(c2) && offset_back > start) {
166-
// look at character before ZWJ to see that both can participate in an
167-
// emoji zwj sequence
168-
uint32_t c0 = 0;
169-
size_t offset_backback = offset_back;
170-
U16_PREV(buf, start, offset_backback, c0);
171-
if (c0 == 0xFE0F && offset_backback > start) {
172-
// skip over emoji variation selector
173-
U16_PREV(buf, start, offset_backback, c0);
174-
}
175-
if (isEmoji(c0)) {
176-
return false;
177-
}
178-
}
166+
// and we also require the character before the ZWJ to also be an emoji. if
167+
// (p1 == U_GCB_ZWJ && isEmoji(c2) && offset_back > start) {
168+
// // look at character before ZWJ to see that both can participate in an
169+
// emoji zwj sequence uint32_t c0 = 0; size_t offset_backback =
170+
// offset_back; U16_PREV(buf, start, offset_backback, c0); if (c0 ==
171+
// 0xFE0F && offset_backback > start) {
172+
// // skip over emoji variation selector
173+
// U16_PREV(buf, start, offset_backback, c0);
174+
// }
175+
// if (isEmoji(c0)) {
176+
// return false;
177+
// }
178+
// }
179179

180180
// Tailored version of Rule GB12 and Rule GB13 that look at even-odd cases.
181181
// sot (RI RI)* RI x RI

third_party/txt/tests/GraphemeBreakTests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ TEST(GraphemeBreak, rules) {
143143

144144
// Rule GB9, x (Extend | ZWJ)
145145
EXPECT_FALSE(IsBreak("'a' | U+0301")); // combining accent
146-
EXPECT_FALSE(IsBreak("'a' | U+200D")); // ZWJ
146+
// TODO(jsimmons): re-enable this test when ICU has been updated in all
147+
// Flutter platforms.
148+
//EXPECT_FALSE(IsBreak("'a' | U+200D")); // ZWJ
147149
// Rule GB9a, x SpacingMark
148150
EXPECT_FALSE(IsBreak("U+0915 | U+093E")); // KA, AA (spacing mark)
149151
// Rule GB9b, Prepend x

0 commit comments

Comments
 (0)