|
2 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
3 | 3 | // Unicode 17.0 Indic_Conjunct_Break data used by UAX #29 rule GB9c. |
4 | 4 |
|
5 | | -using System.Globalization; |
6 | 5 | using System.Runtime.CompilerServices; |
7 | | -using System.Text; |
8 | 6 |
|
9 | 7 | namespace RoyalTerminal.Unicode; |
10 | 8 |
|
@@ -32,31 +30,13 @@ public static IndicConjunctBreakClass Get(Codepoint codepoint) |
32 | 30 | return IndicConjunctBreakClass.Consonant; |
33 | 31 | } |
34 | 32 |
|
35 | | - // Include the non-mark members and Unicode 17 additions that may not |
36 | | - // yet have a mark category in the current .NET Unicode tables. |
37 | | - if (value is 0x200D or |
38 | | - >= 0x1ACF and <= 0x1ADD or |
39 | | - >= 0x1AE0 and <= 0x1AEB or |
40 | | - >= 0xFF9E and <= 0xFF9F or |
41 | | - >= 0x10EFA and <= 0x10EFB or |
42 | | - 0x11B60 or |
43 | | - >= 0x11B62 and <= 0x11B64 or |
44 | | - 0x11B66 or |
45 | | - >= 0x1F3FB and <= 0x1F3FF or |
46 | | - 0x1E6E3 or |
47 | | - 0x1E6E6 or |
48 | | - >= 0x1E6EE and <= 0x1E6EF or |
49 | | - 0x1E6F5 or |
50 | | - >= 0xE0020 and <= 0xE007F) |
51 | | - { |
52 | | - return IndicConjunctBreakClass.Extend; |
53 | | - } |
54 | | - |
55 | | - UnicodeCategory category = |
56 | | - Rune.GetUnicodeCategory(new Rune(checked((int)value))); |
57 | | - return category is UnicodeCategory.NonSpacingMark |
58 | | - or UnicodeCategory.SpacingCombiningMark |
59 | | - or UnicodeCategory.EnclosingMark |
| 33 | + // Unicode 17's generated InCB=Extend set is the generated GCB Extend |
| 34 | + // and ZWJ sets, excluding InCB Linkers (handled above) and ZWNJ. |
| 35 | + // General Unicode mark categories are not equivalent: for example, |
| 36 | + // U+0903 is a spacing combining mark but has InCB=None. |
| 37 | + return value != 0x200C && |
| 38 | + codepoint.GraphemeBreakClass is GraphemeBreakClass.Extend |
| 39 | + or GraphemeBreakClass.ZWJ |
60 | 40 | ? IndicConjunctBreakClass.Extend |
61 | 41 | : IndicConjunctBreakClass.None; |
62 | 42 | } |
|
0 commit comments