Skip to content

Commit 701facf

Browse files
committed
Fix Iteration/Error Message for surrogate pairs
1 parent f784453 commit 701facf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MagesScriptTool/SpecBank.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ static ImmutableArray<GlyphSpec> toGlyphSpecs(JsonElement json) {
6767
Int16 unitsOffset = glyphsJson.GetProperty("unitsOffset").GetInt16();
6868
string text = toText(glyphsJson.GetProperty("text"));
6969
int index = 0;
70-
foreach (char character in text) {
71-
glyphs.Add(new([unitsOffset + index], character.ToString(), style));
70+
TextElementEnumerator charEnum = StringInfo.GetTextElementEnumerator(text);
71+
while (charEnum.MoveNext()) {
72+
glyphs.Add(new([unitsOffset + index], charEnum.GetTextElement(), style));
7273
index++;
7374
}
7475
} else if (glyphsJson.ValueKind == JsonValueKind.Array) {

0 commit comments

Comments
 (0)