3 ms·
Not length directly in itself, but the abstraction seems applicable to text editing controls.
by kaetemi 5y ago
Not length directly in itself, but the abstraction seems applicable to text editing controls.
- arcticbull 5y agoThat’s both #2 and #3, because Unicode characters can have various widths including zero. Gotta find out how far to move the cursor.
- ygra 5y agoThe Unicode character doesn't really have an intrinsic width; the font will define one (and I think a font could define a glyph even for things like zero-width spaces). But as soon as you want to display text you'll get into all sorts of fun problems and string length is most likely never applicable in any way. At that point the Unicode string becomes a sequence of glyphs from a font with their respective placements and there's no guaranteed relationship between the number of glyphs and the original number of code points, anyway.