#[repr(C)]pub struct InlineText {
pub lines: InlineLineVec,
pub content_size: LogicalSize,
pub font_size_px: f32,
pub last_word_index: usize,
pub baseline_descender_px: f32,
}
Expand description
inline text so that hit-testing is easier
Fields§
§lines: InlineLineVec
List of lines, relative to (0.0, 0.0) representing the top left corner of the line
content_size: LogicalSize
Size of the text content, may be larger than the position of lines due to descending glyphs
font_size_px: f32
Size of the font used to layout this line
last_word_index: usize
Index of the last word
baseline_descender_px: f32
NOTE: descender is NEGATIVE (pixels from baseline to font size)
Implementations§
Source§impl InlineText
impl InlineText
Sourcepub fn get_layouted_glyphs(&self) -> LayoutedGlyphs
pub fn get_layouted_glyphs(&self) -> LayoutedGlyphs
Returns the final, positioned glyphs from an inline text
NOTE: It seems that at least in webrender, the glyphs have to be positioned in relation to the screen (instead of relative to the parent container)
The text_origin gets added to each glyph
NOTE: The lines in the text are relative to the TOP left corner (of the text, i.e. relative to the text_origin), but the word position is relative to the BOTTOM left corner (of the line bounds)
Sourcepub fn hit_test(&self, position: LogicalPosition) -> Vec<InlineTextHit>
pub fn hit_test(&self, position: LogicalPosition) -> Vec<InlineTextHit>
Hit tests all glyphs, returns the hit glyphs - note that the result may be empty (no glyphs hit), or it may contain more than one result (overlapping glyphs - more than one glyph hit)
Usually the result will contain a single InlineTextHit
Trait Implementations§
Source§impl Clone for InlineText
impl Clone for InlineText
Source§fn clone(&self) -> InlineText
fn clone(&self) -> InlineText
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for InlineText
impl Debug for InlineText
Source§impl PartialEq for InlineText
impl PartialEq for InlineText
Source§impl PartialOrd for InlineText
impl PartialOrd for InlineText
impl StructuralPartialEq for InlineText
Auto Trait Implementations§
impl Freeze for InlineText
impl RefUnwindSafe for InlineText
impl Send for InlineText
impl Sync for InlineText
impl Unpin for InlineText
impl UnwindSafe for InlineText
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more