Skip to main content

Module text_width

Module text_width 

Source
Expand description

Shared display width helpers for layout and rendering.

This module centralizes glyph width calculation so layout (ftui-text) and rendering (ftui-render) stay in lockstep. It intentionally avoids ad-hoc emoji heuristics and relies on Unicode data tables.

Functionsยง

ascii_width
Fast-path width for pure printable ASCII.
char_width
Width of a single Unicode scalar.
cjk_width_enabled
Cached CJK width policy (fast path).
cjk_width_from_env
Compute CJK width policy using a custom environment lookup.
display_width
Width of a string in terminal cells.
grapheme_width
Width of a single grapheme cluster.