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§
§size_scale: f32
Multiply this to a font EM value to get the size in pixels.
ascent: Px
The maximum amount the font rises above the baseline, in pixels.
descent: Px
The 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: Px
Distance between baselines, in pixels.
underline_position: Px
The suggested distance of the top of the underline from the baseline (negative values indicate below baseline), in pixels.
underline_thickness: Px
A suggested value for the underline thickness, in pixels.
cap_height: Px
The approximate amount that uppercase letters rise above the baseline, in pixels.
x_height: Px
The approximate amount that non-ascending lowercase letters rise above the baseline, in pixels.
bounds: PxRect
A 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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