pub struct Metrics {
units_per_em: f32,
ascent: f32,
descent: f32,
line_gap: f32,
}Expand description
A face’s vertical metrics, in font units — the size-independent numbers a row’s height and a glyph’s baseline are derived from.
Which table they come from is the shaper’s font reader’s business: it
follows FreeType’s rule (OS/2 typo metrics when the face asks for them,
hhea otherwise), which is the rule the desktop’s engine follows too, so
a row is the same height on both.
Fields§
§units_per_em: f32§ascent: f32§descent: f32§line_gap: f32Implementations§
Source§impl Metrics
impl Metrics
Sourcepub fn of(typeface: FontChoice) -> Self
pub fn of(typeface: FontChoice) -> Self
§Panics
If the typeface’s embedded bytes are not a font this can read.
pub fn units_per_em(self) -> f32
Sourcepub fn descent(self, font: &Font) -> f32
pub fn descent(self, font: &Font) -> f32
How far the face descends below the baseline — negative, as the face states it.
Sourcepub fn row_height(self, font: &Font) -> f32
pub fn row_height(self, font: &Font) -> f32
A line’s height, whether or not a glyph sits on it.
Trait Implementations§
impl Copy for Metrics
impl StructuralPartialEq for Metrics
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnsafeUnpin for Metrics
impl UnwindSafe for Metrics
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