pub struct TextLayout {
pub lines: Vec<TextLine>,
pub width: f32,
pub height: f32,
pub line_height: f32,
}Expand description
Measured multi-line text layout. Coordinates are in logical pixels (y-down) relative to the layout origin — the top-left of the rect the layout would be drawn into.
Fields§
§lines: Vec<TextLine>Visual lines in top-to-bottom order.
width: f32Widest line’s width in logical pixels.
height: f32Total height in logical pixels — at least one line_height
even for empty text.
line_height: f32Line height used for this layout, in logical pixels.
Implementations§
Source§impl TextLayout
impl TextLayout
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Number of visual lines, counting empty text as one line.
Sourcepub fn measured(&self) -> MeasuredText
pub fn measured(&self) -> MeasuredText
Collapse to the size-only MeasuredText summary.
Trait Implementations§
Source§impl Clone for TextLayout
impl Clone for TextLayout
Source§fn clone(&self) -> TextLayout
fn clone(&self) -> TextLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextLayout
impl Debug for TextLayout
Source§impl PartialEq for TextLayout
impl PartialEq for TextLayout
Source§fn eq(&self, other: &TextLayout) -> bool
fn eq(&self, other: &TextLayout) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TextLayout
Auto Trait Implementations§
impl Freeze for TextLayout
impl RefUnwindSafe for TextLayout
impl Send for TextLayout
impl Sync for TextLayout
impl Unpin for TextLayout
impl UnsafeUnpin for TextLayout
impl UnwindSafe for TextLayout
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.