#[non_exhaustive]pub struct FontFaceMetrics {
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 bounds: Rect<f32, ()>,
}Expand description
Various metrics that apply to the entire FontFace.
For OpenType fonts, these mostly come from the OS/2 table.
See the FreeType Glyph Metrics documentation for an explanation of the various metrics.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.units_per_em: u32The number of font units per em.
Font sizes are usually expressed in pixels per em; e.g. 12px means 12 pixels per em.
ascent: f32The maximum amount the font rises above the baseline, in font units.
descent: f32The maximum amount the font descends below the baseline, in font units.
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: f32Distance between baselines, in font units.
underline_position: f32The suggested distance of the top of the underline from the baseline (negative values indicate below baseline), in font units.
underline_thickness: f32A suggested value for the underline thickness, in font units.
cap_height: f32The approximate amount that uppercase letters rise above the baseline, in font units.
x_height: f32The approximate amount that non-ascending lowercase letters rise above the baseline, in font units.
bounds: Rect<f32, ()>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.
Implementations§
Source§impl FontFaceMetrics
impl FontFaceMetrics
Sourcepub fn sized(&self, font_size_px: Px) -> FontMetrics
pub fn sized(&self, font_size_px: Px) -> FontMetrics
Compute FontMetrics given a font size in pixels.
Trait Implementations§
Source§impl Clone for FontFaceMetrics
impl Clone for FontFaceMetrics
Source§fn clone(&self) -> FontFaceMetrics
fn clone(&self) -> FontFaceMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FontFaceMetrics
impl Debug for FontFaceMetrics
Source§impl<'de> Deserialize<'de> for FontFaceMetrics
impl<'de> Deserialize<'de> for FontFaceMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<Face<'a>> for FontFaceMetrics
impl<'a> From<Face<'a>> for FontFaceMetrics
Auto Trait Implementations§
impl Freeze for FontFaceMetrics
impl RefUnwindSafe for FontFaceMetrics
impl Send for FontFaceMetrics
impl Sync for FontFaceMetrics
impl Unpin for FontFaceMetrics
impl UnwindSafe for FontFaceMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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