pub struct TextLayout<'a, Font: AbstractFont> {
pub font: &'a Font,
pub letter_spacing: Option<<Font as TextShaper>::Length>,
pub line_height: Option<<Font as TextShaper>::Length>,
}Fields§
§font: &'a Font§letter_spacing: Option<<Font as TextShaper>::Length>§line_height: Option<<Font as TextShaper>::Length>The absolute line height, or None to use FontMetrics::height.
Implementations§
Source§impl<Font: AbstractFont> TextLayout<'_, Font>
impl<Font: AbstractFont> TextLayout<'_, Font>
Sourcepub fn half_leading(&self) -> Font::Length
pub fn half_leading(&self) -> Font::Length
The offset from the top of a line box to the top of the glyph box within it: half of the leading, following the CSS convention of centering the glyphs in the line box, like the parley based layout. Negative when the line height is smaller than the natural font height.
Sourcepub fn cursor_band(&self) -> (Font::Length, Font::Length)
pub fn cursor_band(&self) -> (Font::Length, Font::Length)
The origin (relative to the top of the line box) and height of cursor and selection rectangles: the full line box, but never smaller than the glyph box, mirroring parley’s clamping for negative leading.
pub fn text_size( &self, text: &str, max_width: Option<Font::Length>, text_wrap: TextWrap, max_lines: Option<usize>, ) -> (Font::Length, Font::Length)
pub fn content_widths( &self, text: &str, max_lines: Option<usize>, ) -> (Font::Length, Font::Length)
Auto Trait Implementations§
impl<'a, Font> Freeze for TextLayout<'a, Font>
impl<'a, Font> RefUnwindSafe for TextLayout<'a, Font>
impl<'a, Font> Send for TextLayout<'a, Font>
impl<'a, Font> Sync for TextLayout<'a, Font>
impl<'a, Font> Unpin for TextLayout<'a, Font>
impl<'a, Font> UnsafeUnpin for TextLayout<'a, Font>
impl<'a, Font> UnwindSafe for TextLayout<'a, Font>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more