Struct cosmic_text::ShapeLine

source ·
pub struct ShapeLine {
    pub rtl: bool,
    pub spans: Vec<ShapeSpan>,
}
Expand description

A shaped line (or paragraph)

Fields§

§rtl: bool§spans: Vec<ShapeSpan>

Implementations§

Examples found in repository?
src/buffer_line.rs (line 143)
141
142
143
144
145
146
147
    pub fn shape(&mut self, font_system: &FontSystem) -> &ShapeLine {
        if self.shape_opt.is_none() {
            self.shape_opt = Some(ShapeLine::new(font_system, &self.text, &self.attrs_list));
            self.layout_opt = None;
        }
        self.shape_opt.as_ref().expect("shape not found")
    }
Examples found in repository?
src/buffer_line.rs (lines 159-163)
155
156
157
158
159
160
161
162
163
164
165
166
167
    pub fn layout(&mut self, font_system: &FontSystem, font_size: i32, width: i32) -> &[LayoutLine] {
        if self.layout_opt.is_none() {
            let wrap_simple = self.wrap_simple;
            let shape = self.shape(font_system);
            let layout = shape.layout(
                font_size,
                width,
                wrap_simple
            );
            self.layout_opt = Some(layout);
        }
        self.layout_opt.as_ref().expect("layout not found")
    }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.