Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Tbls.WidthSourceUTF-8 display width computation.
All functions operate on byte strings encoded as UTF-8. Invalid UTF-8 sequences are treated as replacement character U+FFFD with display width 1.
Display width of a single Unicode character: 0 for control characters and combining marks; 2 for wide characters (full-width forms, emoji); 1 otherwise.
Total display width of a UTF-8 string. Sum of display_width_of_uchar over all codepoints.
Returns true if s contains at least one character with display width 2 (wide characters such as emoji). Cyrillic, Latin, and other single-width multi-byte characters return false.
Segment s into maximal runs of wide and non-wide characters, apply narrow to each non-wide run and wide to each wide run, and concatenate the results. Useful for applying ANSI color codes to text containing emoji without affecting the emoji's own rendering.