#[non_exhaustive]pub struct FontMetrics {
pub size_scale: f32,
pub ascent: Px,
pub descent: Px,
pub line_gap: Px,
pub underline_position: Px,
pub underline_thickness: Px,
pub cap_height: Px,
pub x_height: Px,
pub bounds: PxRect,
}Expand description
Various metrics about a Font.
You can compute these metrics from a FontFaceMetrics
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.size_scale: f32Multiply this to a font EM value to get the size in pixels.
ascent: PxThe maximum amount the font rises above the baseline, in pixels.
descent: PxThe maximum amount the font descends below the baseline, in pixels.
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: PxDistance between baselines, in pixels.
underline_position: PxThe suggested distance of the top of the underline from the baseline (negative values indicate below baseline), in pixels.
underline_thickness: PxA suggested value for the underline thickness, in pixels.
cap_height: PxThe approximate amount that uppercase letters rise above the baseline, in pixels.
x_height: PxThe approximate amount that non-ascending lowercase letters rise above the baseline, in pixels.
bounds: PxRectA rectangle that surrounds all bounding boxes of all glyphs, in pixels.
This corresponds to the xMin/xMax/yMin/yMax values in the OpenType head table.
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn line_height(&self) -> Px
pub fn line_height(&self) -> Px
The font line height.
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FontMetrics
impl Debug for FontMetrics
Source§impl<'de> Deserialize<'de> for FontMetrics
impl<'de> Deserialize<'de> for FontMetrics
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>,
Auto Trait Implementations§
impl Freeze for FontMetrics
impl RefUnwindSafe for FontMetrics
impl Send for FontMetrics
impl Sync for FontMetrics
impl Unpin for FontMetrics
impl UnwindSafe for FontMetrics
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