Skip to main content

ScaledMetrics

Struct ScaledMetrics 

Source
pub struct ScaledMetrics<'a, S>
where S: Scale,
{ metrics: &'a Metrics, scale: S, }
Expand description

Measurements of a font as a whole, in a caller’s own units.

A view rather than a set of scaled fields, so reading one measurement does not compute the rest. What carries no unit, such as the glyph count, is reported unchanged.

Fields§

§metrics: &'a Metrics§scale: S

Implementations§

Source§

impl<'a, S> ScaledMetrics<'a, S>
where S: Scale,

Source

pub fn num_glyphs(&self) -> u32

Returns the number of glyphs in the font.

Source

pub fn units_per_em(&self) -> u16

Returns the size of the font’s design em.

Source

pub fn bounds(&self) -> BoundingBox<<S as Scale>::Value>

Returns the box enclosing every glyph in the font.

Source

pub fn h_line(&self) -> Option<LineBox<<S as Scale>::Value>>

Returns the ascender, descender and gap for horizontal text.

Resolved as Metrics::h_line resolves it, with each end scaled on its own so that a caller subtracting them gets the height the glyph metrics report for a font that stacks by this line.

Source

pub fn hhea_line(&self) -> Option<LineBox<<S as Scale>::Value>>

Returns the line hhea provides.

Source

pub fn typo_line(&self) -> Option<LineBox<<S as Scale>::Value>>

Returns the typographic line OS/2 provides.

Source

pub fn use_typo_metrics(&self) -> bool

Returns whether the font asks for its typographic line to be read.

Source

pub fn vhea_line(&self) -> Option<LineBox<<S as Scale>::Value>>

Returns the line vhea provides, where the font has one.

A vertical line runs across the page, so its measurements scale along x where a horizontal line’s scale along y.

Source

pub fn x_height(&self) -> Option<<S as Scale>::Value>

Returns the height of a lowercase letter, where the font provides one.

Source

pub fn cap_height(&self) -> Option<<S as Scale>::Value>

Returns the height of a capital letter, where the font provides one.

Source

pub fn max_h_advance(&self) -> Option<<S as Scale>::Value>

Returns the widest advance in the font, where it provides one.

Source

pub fn max_v_advance(&self) -> Option<<S as Scale>::Value>

Returns the tallest advance in the font, where it provides one.

Source

pub fn average_char_width(&self) -> Option<<S as Scale>::Value>

Returns the average advance in the font, where it provides one.

Source

pub fn win_line(&self) -> Option<LineExtents<<S as Scale>::Value>>

Returns the line outside which the font asks not to be clipped.

Trait Implementations§

Source§

impl<'a, S> Clone for ScaledMetrics<'a, S>
where S: Clone + Scale,

Source§

fn clone(&self) -> ScaledMetrics<'a, S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, S> Copy for ScaledMetrics<'a, S>
where S: Copy + Scale,

Auto Trait Implementations§

§

impl<'a, S> Freeze for ScaledMetrics<'a, S>
where S: Freeze,

§

impl<'a, S> RefUnwindSafe for ScaledMetrics<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for ScaledMetrics<'a, S>
where S: Send,

§

impl<'a, S> Sync for ScaledMetrics<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for ScaledMetrics<'a, S>
where S: Unpin,

§

impl<'a, S> UnsafeUnpin for ScaledMetrics<'a, S>
where S: UnsafeUnpin,

§

impl<'a, S> UnwindSafe for ScaledMetrics<'a, S>
where S: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.