Skip to main content

Module layout

Module layout 

Source
Expand description

Phase 3: Layout and Soft Wrapping (Headless Layout Engine)

Calculates the visual representation of text given a container width. Computes character widths based on UAX #11 and implements headless reflow algorithm.

Structs§

LayoutEngine
Layout engine - manages visual representation of all lines
VisualLineInfo
Visual line information
WrapPoint
Wrap point

Constants§

DEFAULT_TAB_WIDTH
Default tab width (in cells) used when a caller does not specify a tab width.

Functions§

calculate_wrap_points
Calculate wrap points for text
calculate_wrap_points_with_tab_width
Calculate wrap points for text, interpreting '\t' using tab_width.
cell_width_at
Calculate visual width (in cells) for a character at a specific cell offset within the line.
char_width
Calculate visual width of a character (based on UAX #11)
str_width
Calculate total visual width of a string
str_width_with_tab_width
Calculate total visual width of a string, interpreting '\t' using tab_width.
visual_x_for_column
Calculate the visual cell offset from the start of the line to the given character column.