pub struct TextLayoutResult {
pub line_count: usize,
pub width_px: f32,
pub height_px: f32,
pub first_baseline: f32,
pub last_baseline: f32,
pub did_overflow_width: bool,
pub did_overflow_height: bool,
pub lines: Vec<TextLineInfo>,
}Expand description
Result of text layout computation, provided to the on_text_layout callback.
Exposes key information about the rendered text layout.
Fields§
§line_count: usizeNumber of visual lines in the layout.
width_px: f32Total content width in px.
height_px: f32Total content height in px.
first_baseline: f32First baseline position in px.
last_baseline: f32Last baseline position in px.
did_overflow_width: boolWhether text overflows the available width.
did_overflow_height: boolWhether text overflows the available height.
lines: Vec<TextLineInfo>Per-line layout information.
Implementations§
Source§impl TextLayoutResult
impl TextLayoutResult
pub fn get_line_start(&self, line_index: usize) -> Option<usize>
pub fn get_line_end(&self, line_index: usize) -> Option<usize>
pub fn get_line_end_visible(&self, line_index: usize) -> Option<usize>
pub fn is_line_ellipsized(&self, _line_index: usize) -> bool
pub fn get_line_top(&self, line_index: usize) -> Option<f32>
pub fn get_line_baseline(&self, line_index: usize) -> Option<f32>
pub fn get_line_bottom(&self, line_index: usize) -> Option<f32>
pub fn get_line_left(&self, line_index: usize) -> Option<f32>
pub fn get_line_right(&self, line_index: usize) -> Option<f32>
pub fn get_line_for_offset(&self, offset: usize) -> usize
pub fn get_line_for_vertical_position(&self, vertical: f32) -> usize
pub fn get_horizontal_position( &self, offset: usize, _use_primary_direction: bool, ) -> f32
Sourcepub fn has_visual_overflow(&self) -> bool
pub fn has_visual_overflow(&self) -> bool
Returns true if the text has visual overflow in either direction.
Sourcepub fn get_bounding_box(&self, offset: usize) -> Rect
pub fn get_bounding_box(&self, offset: usize) -> Rect
Returns the bounding box of the character at the given offset. Returns a zero rect if the offset is out of range.
Sourcepub fn get_cursor_rect(&self, offset: usize) -> Rect
pub fn get_cursor_rect(&self, offset: usize) -> Rect
Returns the cursor rectangle at the given offset.
Sourcepub fn get_offset_for_position(&self, position: (f32, f32)) -> Option<usize>
pub fn get_offset_for_position(&self, position: (f32, f32)) -> Option<usize>
Returns the offset closest to the given position.
Sourcepub fn get_word_boundary(&self, _offset: usize) -> TextRange
pub fn get_word_boundary(&self, _offset: usize) -> TextRange
Returns the text range of the word at the given offset.
Sourcepub fn get_paragraph_direction(&self, _offset: usize) -> u8
pub fn get_paragraph_direction(&self, _offset: usize) -> u8
Returns the paragraph direction at the given offset.
Sourcepub fn get_bidi_run_direction(&self, _offset: usize) -> u8
pub fn get_bidi_run_direction(&self, _offset: usize) -> u8
Returns the BiDi run direction at the given offset.
Trait Implementations§
Source§impl Clone for TextLayoutResult
impl Clone for TextLayoutResult
Source§fn clone(&self) -> TextLayoutResult
fn clone(&self) -> TextLayoutResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more