Skip to main content

FontMetrics

Struct FontMetrics 

Source
pub struct FontMetrics { /* private fields */ }
Expand description

A Font’s measures: the text laid out as Font::layout lays it out, with no markup, so that a caret is where the glyphs are drawn.

Implementations§

Source§

impl FontMetrics

Source

pub fn new(font: Font) -> Self

The measures of font, a copy of the font the debug UI draws with.

Source

pub fn font(&self) -> &Font

The font.

Trait Implementations§

Source§

impl Debug for FontMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TextMetrics for FontMetrics

Source§

fn line_height(&self) -> f32

The height of a line.
Source§

fn caret_x(&self, text: &str, byte: usize) -> f32

Where the pen is before the character at byte of the one-line text, from the text’s start: the kerning before that character included, and spaces taking their room. At text.len(), it is the pen after the last character, the text’s width. byte is a character boundary of text, or its length.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.