Struct cosmic_text::ShapeLine
source · Expand description
A shaped line (or paragraph)
Fields§
§rtl: bool§spans: Vec<ShapeSpan>Implementations§
source§impl ShapeLine
impl ShapeLine
sourcepub fn new<'a>(
font_system: &'a FontSystem,
line: &str,
attrs_list: &AttrsList
) -> Self
pub fn new<'a>(
font_system: &'a FontSystem,
line: &str,
attrs_list: &AttrsList
) -> Self
sourcepub fn layout(
&self,
font_size: i32,
line_width: i32,
wrap_simple: bool
) -> Vec<LayoutLine>
pub fn layout(
&self,
font_size: i32,
line_width: i32,
wrap_simple: bool
) -> Vec<LayoutLine>
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")
}