Struct Metrics
pub struct Metrics {Show 14 fields
pub units_per_em: u16,
pub glyph_count: u16,
pub is_monospace: bool,
pub italic_angle: f32,
pub ascent: f32,
pub descent: f32,
pub leading: f32,
pub cap_height: Option<f32>,
pub x_height: Option<f32>,
pub average_width: Option<f32>,
pub max_width: Option<f32>,
pub underline: Option<Decoration>,
pub strikeout: Option<Decoration>,
pub bounds: Option<BoundingBox<f32>>,
}Expand description
Metrics that apply to all glyphs in a font.
These are retrieved for a specific position in the design space.
This metrics here are derived from the following tables:
- head:
units_per_em,bounds - maxp:
glyph_count - post:
is_monospace,italic_angle,underline - OS/2:
average_width,cap_height,x_height,strikeout, as well as the line metrics:ascent,descent,leadingif theUSE_TYPOGRAPHIC_METRICSflag is set or thehhealine metrics are zero (the Windows metrics are used as a last resort). - hhea:
max_width, as well as the line metrics:ascent,descent,leadingif they are non-zero and theUSE_TYPOGRAPHIC_METRICSflag is not set in the OS/2 table
For variable fonts, deltas are computed using the MVAR table.
Fields§
§units_per_em: u16Number of font design units per em unit.
glyph_count: u16Number of glyphs in the font.
is_monospace: boolTrue if the font is not proportionally spaced.
italic_angle: f32Italic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right.
ascent: f32Distance from the baseline to the top of the alignment box.
descent: f32Distance from the baseline to the bottom of the alignment box.
leading: f32Recommended additional spacing between lines.
cap_height: Option<f32>Distance from the baseline to the top of a typical English capital.
x_height: Option<f32>Distance from the baseline to the top of the lowercase “x” or similar character.
average_width: Option<f32>Average width of all non-zero width characters in the font.
max_width: Option<f32>Maximum advance width of all characters in the font.
underline: Option<Decoration>Metrics for an underline decoration.
strikeout: Option<Decoration>Metrics for a strikeout decoration.
bounds: Option<BoundingBox<f32>>Union of minimum and maximum extents for all glyphs in the font.
Implementations§
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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync 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