Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 5774b99

Browse files
author
Yuncong Zhang
committed
Don't skip surrogate pairs.
1 parent 9360525 commit 5774b99

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Runtime/ui/painting/canvas_impl.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,7 @@ void _drawTextBlob(TextBlob textBlob, Offset offset, Paint paint) {
769769
layer.draws.Add(CanvasShader.texAlpha(layer, p, mesh, tex));
770770
}
771771
else {
772-
Paint paintWithWhite = new Paint(p);
773-
paintWithWhite.color = Colors.white;
772+
Paint paintWithWhite = new Paint(p) {color = Colors.white};
774773
layer.draws.Add(CanvasShader.tex(layer, paintWithWhite, mesh.resolveMesh(), EmojiUtils.image));
775774
}
776775
};

Runtime/ui/txt/wordbreaker.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void setText(TextBuff text) {
2828
this._current = 0;
2929
this._scanOffset = 0;
3030
this._inEmailOrUrl = false;
31-
this.nextUntilCodePoint();
31+
// this.nextUntilCodePoint();
3232
}
3333

3434
public int current() {
@@ -98,7 +98,7 @@ int _findNextBoundaryNormal() {
9898
}
9999

100100
for (; this._current < this._text.size; ++this._current) {
101-
this.nextUntilCodePoint();
101+
// this.nextUntilCodePoint();
102102
if (this._current >= this._text.size) {
103103
break;
104104
}

Tests/Editor/Paragraph.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,23 @@ RenderBox text() {
116116
text:
117117
"This is FontStyle.italic And 发撒放豆腐sad 发生的 Bold Text This is FontStyle.italic And Bold Text\n\n"),
118118
new TextSpan(style: new TextStyle(fontSize: 18),
119-
text: "FontSize 18: Get a named matrix value from the shader."),
119+
text: "FontSize 18: Get a named matrix value from the shader.\n\n"),
120120
new TextSpan(style: new TextStyle(fontSize: 24),
121121
text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00"),
122122
new TextSpan(style: new TextStyle(fontSize: 14),
123123
text: "Emoji \ud83d\ude0a\ud83d\ude0b\ud83d\ude0d\ud83d\ude0e\ud83d\ude00 Emoji"),
124124
new TextSpan(style: new TextStyle(fontSize: 18),
125125
text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
126126
new TextSpan(style: new TextStyle(fontSize: 18),
127-
text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05 Emoji Emoji"),
127+
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
128128
new TextSpan(style: new TextStyle(fontSize: 18),
129-
text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05 Emoji Emoji Emoji"),
129+
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
130130
new TextSpan(style: new TextStyle(fontSize: 18),
131-
text: "Emoji \ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
131+
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
132+
new TextSpan(style: new TextStyle(fontSize: 18),
133+
text: "\ud83d\ude01\ud83d\ude02\ud83d\ude03\ud83d\ude04\ud83d\ude05"),
132134
new TextSpan(style: new TextStyle(fontSize: 24),
133-
text: "Emoji \ud83d\ude06\ud83d\ude1C\ud83d\ude18\ud83d\ude2D\ud83d\ude0C\ud83d\ude1EEmoji"),
135+
text: "Emoji \ud83d\ude06\ud83d\ude1C\ud83d\ude18\ud83d\ude2D\ud83d\ude0C\ud83d\ude1E\n\n"),
134136
new TextSpan(style: new TextStyle(fontSize: 14),
135137
text: "FontSize 14"),
136138
})));

0 commit comments

Comments
 (0)