Skip to main content

euv_core/font/measurer/
trait.rs

1use super::*;
2
3/// Pluggable text measurement interface enabling deterministic cross-platform text layout.
4pub trait TextMeasurer {
5    /// Measures and wraps `text` under `style` within an optional `max_width` constraint.
6    ///
7    /// # Arguments
8    ///
9    /// - `&Self` - Text measurer reference.
10    /// - `&str` - UTF-8 text to lay out.
11    /// - `TextStyle` - Typography style parameters.
12    /// - `Option<f32>` - Optional maximum line width in logical pixels.
13    ///
14    /// # Returns
15    ///
16    /// - `TextLayoutResult` - Wrapped lines and aggregate bounding box.
17    fn measure(&self, text: &str, style: TextStyle, max_width: Option<f32>) -> TextLayoutResult;
18}