Skip to content

Commit 73af5d8

Browse files
committed
Reduce properties, just Wide
1 parent d6277d7 commit 73af5d8

3 files changed

Lines changed: 243 additions & 289 deletions

File tree

internal/gen/unicode.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,19 @@ type PropertyDefinition struct {
3737
// The order matters - it defines the bit positions (via iota).
3838
var PropertyDefinitions = []PropertyDefinition{
3939
{"Zero_Width", "Always 0 width, includes combining marks, control characters, non-printable, etc"},
40-
{"East_Asian_Wide", "Always 2 wide (East Asian Wide F/W)"},
40+
{"Wide", "Always 2 wide (East Asian Wide F/W, Emoji, Regional Indicator)"},
4141
{"East_Asian_Ambiguous", "Width depends on EastAsianWidth option"},
42-
{"Emoji", "Extended_Pictographic + Emoji_Presentation"},
43-
{"Regional_Indicator", "Regional Indicator symbols (used in flag emoji pairs)"},
4442
}
4543

4644
// these constants are used to build the property bitmap, internally.
4745
// the external properties are above. Keep them in the same order!
4846
const (
4947
// ZWSP, ZWJ, ZWNJ, etc.
5048
zero_Width property = iota + 1
51-
// F, W (East Asian Wide)
52-
east_Asian_Wide
49+
// F, W (East Asian Wide), Emoji, Regional Indicator
50+
wide
5351
// A (East Asian Ambiguous)
5452
east_Asian_Ambiguous
55-
// Extended_Pictographic + Emoji_Presentation but not East Asian Wide
56-
emoji
57-
// Regional Indicator symbols (1F1E6..1F1FF)
58-
regional_Indicator
5953
)
6054

6155
// ParseUnicodeData downloads and parses all required Unicode data files
@@ -351,17 +345,17 @@ func buildPropertyBitmap(r rune, data *UnicodeData) property {
351345

352346
// Check for Regional Indicator before emoji
353347
if data.RegionalIndicator[r] {
354-
return regional_Indicator
348+
return wide
355349
}
356350

357351
if data.ExtendedPictographic[r] && data.EmojiPresentation[r] {
358-
return emoji
352+
return wide
359353
}
360354

361355
if eaw, exists := data.EastAsianWidth[r]; exists {
362356
switch eaw {
363357
case "F", "W":
364-
return east_Asian_Wide
358+
return wide
365359
case "A":
366360
return east_Asian_Ambiguous
367361
// H (Halfwidth), Na (Narrow), and N (Neutral) are not stored

0 commit comments

Comments
 (0)