Skip to main content

Module layout

Module layout 

Source
Expand description

Text layout: measurement, word wrapping, and bounded alignment.

HAlign and VAlign are plain data (no allocation, no text handling) and are always available regardless of the egc feature; Surface::print_aligned uses them directly. crate::text::Span and crate::text::Line provide styled text primitives, and TextLayout is a builder that word-wraps a crate::text::Line to a bounded Rect, then positions it with independent horizontal (HAlign) and vertical (VAlign) alignment. Measure the result before rendering with TextLayout::measure. wrap exposes that same word-wrap pass standalone, for callers that need the broken-apart crate::text::Lines rather than a rendered surface.

TextLayout and wrap are only available when the egc feature is enabled (requires alloc): both call into unicode-segmentation/unicode-width directly, with no non-egc fallback path.

Structs§

TextLayoutegc
Builder for laying out a Line within a bounded Rect.

Enums§

HAlign
Horizontal alignment within a bounded rectangle.
VAlign
Vertical alignment within a bounded rectangle.

Functions§

wrapegc
Word-wraps line to max_width columns, returning the broken-apart Lines.