-
Notifications
You must be signed in to change notification settings - Fork 729
Description
The StringInfo provides utility methods for enumerating Unicode grapheme clusters (user-perceived characters) in a string. A grapheme cluster may consist of one or more Rune values, including combining marks or zero-width joiner (ZWJ) sequences such as emoji family groups.
Currently, a single cell consists of one Rune and only combination marks, which by itself is not capable of rendering all possible valid combinations. A combination can involve several normal runes, with a width of 1 or 2 columns, and valid combination marks and bandages.
Therefore, instead of performing the arduous task of manipulating rune combinations, we use the API that .NET already provides.
After this implementation, it becomes much easier to understand how to render and measure a grapheme.
A grapheme always renders a single unit code, regardless of whether it occupies 1 or 2 columns.
Here are some examples of measuring the total width of codepoint sequences based on the width of each individual codepoint, assuming that all categories are correctly identified.:
| Width of each code point | Total | Valid |
|---|---|---|
| 0 (Alone) | 0 | 1 |
| 0+1 | 1 | 1 |
| 1+0 | 1 | 1 |
| 0+2 | 2 | 2 |
| 2+0 | 2 | 2 |
| 1+1 | 2 | 2 |
| 1+0+1 | 2 | 2 |
| 1+1+1 | 3 | 2 |
| 2+1 | 3 | 2 |
| 2+0+1 | 3 | 2 |
| 2+0+2 | 4 | 2 |
| 2+0+2+0+2 | 6 | 2 |
| 2+0+1+2 | 5 | 2 |
| 2+1+1 | 4 | 2 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status