Skip to main content

TextMeasurer

Trait TextMeasurer 

Source
pub trait TextMeasurer {
    // Required method
    fn measure(
        &self,
        text: &str,
        style: TextStyle,
        max_width: Option<f32>,
    ) -> TextLayoutResult;
}
Expand description

Pluggable text measurement interface enabling deterministic cross-platform text layout.

Required Methods§

Source

fn measure( &self, text: &str, style: TextStyle, max_width: Option<f32>, ) -> TextLayoutResult

Measures and wraps text under style within an optional max_width constraint.

§Arguments
  • &Self - Text measurer reference.
  • &str - UTF-8 text to lay out.
  • TextStyle - Typography style parameters.
  • Option<f32> - Optional maximum line width in logical pixels.
§Returns
  • TextLayoutResult - Wrapped lines and aggregate bounding box.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TextMeasurer for DeterministicTextMeasurer

Deterministic cross-platform TextMeasurer implementation.