Skip to main content

euv_core/font/measurer/
struct.rs

1use super::*;
2
3/// Single laid-out text line with its measured pixel width.
4#[derive(Clone, Debug, Default, Getter, New, PartialEq)]
5pub struct TextLine {
6    /// Line text content.
7    pub(crate) text: String,
8    /// Measured logical width of this line in pixels.
9    #[get(type(copy))]
10    pub(crate) width: f32,
11}
12
13/// Complete text measurement result used identically by layout and rendering passes.
14#[derive(Clone, Debug, Default, Getter, New, PartialEq)]
15pub struct TextLayoutResult {
16    /// Individual wrapped or truncated lines.
17    pub(crate) lines: Vec<TextLine>,
18    /// Total bounding box size in logical pixels.
19    #[get(type(copy))]
20    pub(crate) size: Size,
21    /// Computed pixel height of each line.
22    #[get(type(copy))]
23    pub(crate) line_height_px: f32,
24}
25
26/// Deterministic zero-dependency text measurer guaranteeing identical wrapping across all 7 platforms.
27#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct DeterministicTextMeasurer;