Unicode Support โ
TUI.zig is built with full Unicode support in mind.
Grapheme Clusters โ
The library correctly handles grapheme clusters, meaning complex characters (like emojis with modifiers or combined accents) are treated as single visual units.
- "e" + "ยด" = "รฉ" (1 grapheme)
- "๐จ" + "โ" + "๐ฉ" + "โ" + "๐ง" = Family emoji (1 grapheme)
Display Width โ
We use the standard wcwidth logic to determine how many terminal cells a character occupies:
- Standard Latin: 1 cell
- CJK Characters: 2 cells
- Emojis: 2 cells
- Combining marks: 0 cells (rendered atop previous)
API โ
The unicode module provides utilities:
zig
const width = tui.unicode.stringWidth("Hello ๐");
// width = 6 (Hello) + 1 (space) + 2 (๐) = 9Fonts โ
Note that correct rendering ultimately depends on the user's terminal emulator and font support.