pub struct TextMeasurement {
pub size: Size,
pub line_height: f32,
pub first_baseline: f32,
pub line_count: usize,
}Expand description
What a string occupies once laid out — the answer
DrawScope::measure_text gives, and
exactly the box draw_text fills.
Fields§
§size: SizeTight block size: the widest line by its total advance, and
line_count * line_height tall.
line_height: f32Baseline-to-baseline distance.
first_baseline: f32Distance from the top of the block down to the first line’s baseline.
Subtract it from a baseline y to get the top-left a _at draw wants.
line_count: usizeNumber of laid-out lines. 1 for an empty string.
Implementations§
Source§impl TextMeasurement
impl TextMeasurement
Sourcepub fn empty(line_height: f32, first_baseline: f32) -> TextMeasurement
pub fn empty(line_height: f32, first_baseline: f32) -> TextMeasurement
The measurement of an empty string: no extent, but still one line’s worth of vertical metrics so callers can lay out an empty label.
Trait Implementations§
Source§impl Clone for TextMeasurement
impl Clone for TextMeasurement
Source§fn clone(&self) -> TextMeasurement
fn clone(&self) -> TextMeasurement
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 moreimpl Copy for TextMeasurement
Source§impl Debug for TextMeasurement
impl Debug for TextMeasurement
Source§impl PartialEq for TextMeasurement
impl PartialEq for TextMeasurement
impl StructuralPartialEq for TextMeasurement
Auto Trait Implementations§
impl Forget for TextMeasurement
impl Freeze for TextMeasurement
impl Move for TextMeasurement
impl RefUnwindSafe for TextMeasurement
impl Send for TextMeasurement
impl Sync for TextMeasurement
impl Unpin for TextMeasurement
impl UnsafeUnpin for TextMeasurement
impl UnwindSafe for TextMeasurement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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