pub struct FontMetrics {
pub x_height: Option<Length>,
pub zero_advance_measure: Option<Length>,
pub cap_height: Option<Length>,
pub ic_width: Option<Length>,
pub ascent: Length,
pub script_percent_scale_down: Option<f32>,
pub script_script_percent_scale_down: Option<f32>,
}Expand description
Represents the font metrics that style needs from a font to compute the
value of certain CSS units like ex.
Fields§
§x_height: Option<Length>The x-height of the font.
zero_advance_measure: Option<Length>The zero advance. This is usually writing mode dependent
cap_height: Option<Length>The cap-height of the font.
ic_width: Option<Length>The ideographic-width of the font.
ascent: LengthThe ascent of the font (a value is always available for this).
script_percent_scale_down: Option<f32>Script scale down factor for math-depth 1. https://w3c.github.io/mathml-core/#dfn-scriptpercentscaledown
script_script_percent_scale_down: Option<f32>Script scale down factor for math-depth 2. https://w3c.github.io/mathml-core/#dfn-scriptscriptpercentscaledown
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn x_height_or_default(&self, reference_font_size: Length) -> Length
pub fn x_height_or_default(&self, reference_font_size: Length) -> Length
Returns the x-height, computing a fallback value if not present
Sourcepub fn zero_advance_measure_or_default(
&self,
reference_font_size: Length,
upright: bool,
) -> Length
pub fn zero_advance_measure_or_default( &self, reference_font_size: Length, upright: bool, ) -> Length
Returns the zero advance measure, computing a fallback value if not present
Sourcepub fn cap_height_or_default(&self) -> Length
pub fn cap_height_or_default(&self) -> Length
Returns the cap-height, computing a fallback value if not present
Sourcepub fn ic_width_or_default(&self, reference_font_size: Length) -> Length
pub fn ic_width_or_default(&self, reference_font_size: Length) -> Length
Returns the ideographic advance measure, computing a fallback value if not present
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 Default for FontMetrics
impl Default for FontMetrics
Source§impl PartialEq for FontMetrics
impl PartialEq for FontMetrics
impl StructuralPartialEq for FontMetrics
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> 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