Skip to main content

Module text

Module text 

Source
Expand description

Text measurement interface and allocation-free text helpers.

The core needs text widths for axis sizing and label layout but must not depend on a font library. Hosts pass a TextMeasurer (implemented on top of ferrochart-text by the backends). ASCII text, which covers almost every axis label, is measured by summing a per-font advance table: no callback per label, no cache, no allocation.

Structs§

StackStr
A fixed-capacity string on the stack, for formatting labels without allocating. Writes beyond the capacity fail with fmt::Error.

Traits§

TextMeasurer
Measures text for layout.

Functions§

text_width
Width of text in physical pixels: the fast path for ASCII (and ASCII with subscript digits, when the measurer has their table), TextMeasurer::measure otherwise.