pub struct WordPositions {
pub text_layout_options: ResolvedTextLayoutOptions,
pub word_positions: Vec<LayoutPoint>,
pub line_breaks: Vec<(WordIndex, LineLength)>,
pub trailing: f32,
pub number_of_words: usize,
pub number_of_lines: usize,
pub content_size: LayoutSize,
}
Expand description
Stores the positions of the vertically laid out texts
Fields§
§text_layout_options: ResolvedTextLayoutOptions
Options like word spacing, character spacing, etc. that were used to layout these glyphs
word_positions: Vec<LayoutPoint>
Stores the positions of words.
line_breaks: Vec<(WordIndex, LineLength)>
Index of the word at which the line breaks + length of line (useful for text selection + horizontal centering)
trailing: f32
Horizontal width of the last line (in pixels), necessary for inline layout later on, so that the next text run can contine where the last text run left off.
Usually, the “trailing” of the current text block is the “leading” of the next text block, to make it seem like two text runs push into each other.
number_of_words: usize
How many words are in the text?
number_of_lines: usize
How many lines (NOTE: virtual lines, meaning line breaks in the layouted text) are there?
content_size: LayoutSize
Horizontal and vertical boundaries of the layouted words.
Note that the vertical extent can be larger than the last words’ position, because of trailing negative glyph advances.
Trait Implementations§
Source§impl Clone for WordPositions
impl Clone for WordPositions
Source§fn clone(&self) -> WordPositions
fn clone(&self) -> WordPositions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WordPositions
impl Debug for WordPositions
Source§impl PartialEq for WordPositions
impl PartialEq for WordPositions
impl StructuralPartialEq for WordPositions
Auto Trait Implementations§
impl Freeze for WordPositions
impl RefUnwindSafe for WordPositions
impl Send for WordPositions
impl Sync for WordPositions
impl Unpin for WordPositions
impl UnwindSafe for WordPositions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)