Adds the code point widths to measure a string
All 5 scenarios hold
The formatter measures alignment in terminal display columns, not in characters. These rules say how wide a value renders in a monospaced font. The Column width feature and the Cell padding and alignment feature build on them.
A string is as wide as its code points together. The rule above says what each code point contributes. A string of square-bodied glyphs is twice as wide as its character count. A string of both kinds is wider than its character count, and less than twice it.
A null string and an empty string both draw nothing. The formatter measures both as zero, and rejects neither.
expected outcome
broken scenario
| Scenario | Text | Width? |
|---|---|---|
| Every glyph one column | Hello | 5 |
| Every glyph two columns | 你好世界 | 8 |
| One-column and two-column mixed | Hello 👋 World | 14 |
| A null string | 0 | |
| An empty string | “” | 0 |