Skip to main content

cranpose_ui/
text_layout_result.rs

1//! The layout of a text, as Compose's `TextLayoutResult` gives it.
2
3use cranpose_text::TextLayout;
4
5/// The layout of a text: Compose's `TextLayoutResult`. Its queries are the
6/// layout's, in logical pixels from the text's top left corner, with byte
7/// offsets into the text.
8#[derive(Clone, Debug)]
9pub struct TextLayoutResult {
10    layout: TextLayout,
11}
12
13impl TextLayoutResult {
14    /// The result of `layout`.
15    pub fn new(layout: TextLayout) -> Self {
16        Self { layout }
17    }
18
19    /// The lines and glyphs, and every query on them.
20    pub fn layout(&self) -> &TextLayout {
21        &self.layout
22    }
23}