Skip to content

Commit

Permalink
Give spacing marks space (#17826)
Browse files Browse the repository at this point in the history
Spacing marks are called so, because they have a positive advance
width, unlike their non-spacing neighbors (as the name indicates).
After this we stop assigning such gc=Mc codepoints a zero width.

Closes #17810

(cherry picked from commit 0cb3426)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgSg1L4
Service-Version: 1.22
  • Loading branch information
lhecker authored and DHowett committed Sep 4, 2024
1 parent 3d01439 commit 649d8b2
Show file tree
Hide file tree
Showing 2 changed files with 463 additions and 390 deletions.
5 changes: 2 additions & 3 deletions src/tools/GraphemeTableGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
}
buf.Append("};\n");

buf.Append($"constexpr uint{trie.Stages[^1].Bits}_t ucdLookup(const char32_t cp) noexcept\n");
buf.Append("constexpr int ucdLookup(const char32_t cp) noexcept\n");
buf.Append("{\n");
foreach (var stage in trie.Stages)
{
Expand Down Expand Up @@ -290,11 +290,10 @@ static Ucd ExtractValuesFromUcd(string path)
};

// There's no "ea" attribute for "zero width" so we need to do that ourselves. This matches:
// Mc: Mark, spacing combining
// Me: Mark, enclosing
// Mn: Mark, non-spacing
// Cf: Control, format
if (generalCategory.StartsWith("M") || generalCategory == "Cf")
if (generalCategory == "Me" || generalCategory == "Mn" || generalCategory == "Cf")
{
width = CharacterWidth.ZeroWidth;
}
Expand Down
Loading

0 comments on commit 649d8b2

Please sign in to comment.