4 ms·
Width of text is a discreet thing from string "length"… or, well, string "length" is particularly vague. But lets presume the OP meant length in unicode code po
by deathanatos 5y ago
Width of text is a discreet thing from string "length"… or, well, string "length" is particularly vague. But lets presume the OP meant length in unicode code points or grapheme clusters. (Neither of these will be width under a fixed width font. There's also length in bytes, which ofc. is also not width in a fixed width font.)
E.g., most Asian characters & emoji are 2 cell widths in a fixed with font for a single character. The character "e" is 1 byte in UTF-8, "é" is >1. The "family of four" emoji can be up to 11 code points, 41 bytes (in utf-8), and 2 cell widths (still just an emoji) and is, I presume, a single grapheme cluster.