Skip to main content

TextLayoutEngine

Trait TextLayoutEngine 

pub trait TextLayoutEngine {
    // Required methods
    fn measure(
        &mut self,
        renderer: &mut TextRenderer,
        text: &str,
        constraints: TextLayoutConstraints,
        style: &TextStyle,
    ) -> (f32, f32);
    fn draw(
        &mut self,
        renderer: &mut TextRenderer,
        scene: &mut Scene,
        text: &str,
        constraints: TextLayoutConstraints,
        style: &TextStyle,
        color: AlphaColor<Srgb>,
        transform: Affine,
    );

    // Provided method
    fn revision(&self) -> u64 { ... }
}
Expand description

Replaceable measurement/painting boundary used by crate::widget::Text. Implementations keep localization, accessibility, Taffy integration, scene caching, and inspection supplied by the standard widget. style is always renderer-relative: implementations which delegate to TextRenderer pass it through unchanged. For theme-resolved or fixed-size widgets, Text compensates the font size for the renderer’s current multiplier before this boundary; renderer-relative letter spacing keeps its established behavior.

Required Methods§

fn measure( &mut self, renderer: &mut TextRenderer, text: &str, constraints: TextLayoutConstraints, style: &TextStyle, ) -> (f32, f32)

fn draw( &mut self, renderer: &mut TextRenderer, scene: &mut Scene, text: &str, constraints: TextLayoutConstraints, style: &TextStyle, color: AlphaColor<Srgb>, transform: Affine, )

Provided Methods§

fn revision(&self) -> u64

Change when internal layout-affecting configuration changes.

Implementors§