pub struct TextView<'a> { /* private fields */ }Expand description
Laid-out text, ready to draw. Lines can stick out of the node’s rectangle when it is too small for them; draw them unclipped, as CSS does. The window’s damage covers them.
Implementations§
Source§impl<'a> TextView<'a>
impl<'a> TextView<'a>
Sourcepub fn buffer(&self) -> &'a Buffer
pub fn buffer(&self) -> &'a Buffer
The cosmic-text buffer layout measured, for drawing glyphs from.
Sourcepub fn runs(&self) -> impl Iterator<Item = TextRun<'a>> + 'a
pub fn runs(&self) -> impl Iterator<Item = TextRun<'a>> + 'a
The lines to draw: the buffer’s lines, at most max_lines. Glyph
positions are relative to origin.
Sourcepub fn color(&self) -> Color
pub fn color(&self) -> Color
The color to draw in, inherited if the text’s own style doesn’t set one.
Sourcepub fn span(&self, line: usize, glyph: &LayoutGlyph) -> Option<&'a Span>
pub fn span(&self, line: usize, glyph: &LayoutGlyph) -> Option<&'a Span>
The span of a rich text that glyph, on the run of buffer line
line, belongs to, if any. The ellipsis belongs to none, though
cosmic-text gives it the first span’s color.
Sourcepub fn glyph_lit(&self, line: usize, glyph: &LayoutGlyph) -> bool
pub fn glyph_lit(&self, line: usize, glyph: &LayoutGlyph) -> bool
Whether glyph, on the run of buffer line line, belongs to a
link drawn lit, because the pointer is over it or the keyboard focus
is on it: underlined, and in
link_hover_color if the text has one.
Sourcepub fn link_hover_color(&self) -> Option<Color>
pub fn link_hover_color(&self) -> Option<Color>
The color a lit link is drawn in; without one it keeps its own.
Sourcepub fn strikethrough(&self) -> bool
pub fn strikethrough(&self) -> bool
Whether to draw a line through the glyphs, in the text’s color.