Struct font_kit::metrics::Metrics

source ·
pub struct Metrics {
    pub units_per_em: u32,
    pub ascent: f32,
    pub descent: f32,
    pub line_gap: f32,
    pub underline_position: f32,
    pub underline_thickness: f32,
    pub cap_height: f32,
    pub x_height: f32,
    pub bounding_box: RectF,
}
Expand description

Various metrics that apply to the entire font.

For OpenType fonts, these mostly come from the OS/2 table.

Fields§

§units_per_em: u32

The number of font units per em.

Font sizes are usually expressed in pixels per em; e.g. 12px means 12 pixels per em.

§ascent: f32

The maximum amount the font rises above the baseline, in font units.

§descent: f32

The maximum amount the font descends below the baseline, in font units.

NB: This is typically a negative value to match the definition of sTypoDescender in the OS/2 table in the OpenType specification. If you are used to using Windows or Mac APIs, beware, as the sign is reversed from what those APIs return.

§line_gap: f32

Distance between baselines, in font units.

§underline_position: f32

The suggested distance of the top of the underline from the baseline (negative values indicate below baseline), in font units.

§underline_thickness: f32

A suggested value for the underline thickness, in font units.

§cap_height: f32

The approximate amount that uppercase letters rise above the baseline, in font units.

§x_height: f32

The approximate amount that non-ascending lowercase letters rise above the baseline, in font units.

§bounding_box: RectF

A rectangle that surrounds all bounding boxes of all glyphs, in font units.

This corresponds to the xMin/xMax/yMin/yMax values in the OpenType head table.

Trait Implementations§

source§

impl Clone for Metrics

source§

fn clone(&self) -> Metrics

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Metrics

source§

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

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

impl Copy for Metrics

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

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.