pub struct ScaledMetrics<'a, S: Scale> {
metrics: &'a Metrics,
scale: S,
}Expand description
Measurements of a font as a whole, in a caller’s own units.
A view rather than a set of scaled fields, so reading one measurement does not compute the rest. What carries no unit, such as the glyph count, is reported unchanged.
Fields§
§metrics: &'a Metrics§scale: SImplementations§
Source§impl<'a, S: Scale> ScaledMetrics<'a, S>
impl<'a, S: Scale> ScaledMetrics<'a, S>
pub(crate) fn new(metrics: &'a Metrics, scale: S) -> Self
Sourcepub fn num_glyphs(&self) -> u32
pub fn num_glyphs(&self) -> u32
Returns the number of glyphs in the font.
Sourcepub fn units_per_em(&self) -> u16
pub fn units_per_em(&self) -> u16
Returns the size of the font’s design em.
Sourcepub fn bounds(&self) -> BoundingBox<S::Value>
pub fn bounds(&self) -> BoundingBox<S::Value>
Returns the box enclosing every glyph in the font.
Sourcepub fn h_line(&self) -> Option<LineBox<S::Value>>
pub fn h_line(&self) -> Option<LineBox<S::Value>>
Returns the ascender, descender and gap for horizontal text.
Resolved as Metrics::h_line resolves it, with each end
scaled on its own so that a caller subtracting them gets the height
the glyph metrics report for a font that stacks by this line.
Sourcepub fn typo_line(&self) -> Option<LineBox<S::Value>>
pub fn typo_line(&self) -> Option<LineBox<S::Value>>
Returns the typographic line OS/2 provides.
Sourcepub fn use_typo_metrics(&self) -> bool
pub fn use_typo_metrics(&self) -> bool
Returns whether the font asks for its typographic line to be read.
Sourcepub fn vhea_line(&self) -> Option<LineBox<S::Value>>
pub fn vhea_line(&self) -> Option<LineBox<S::Value>>
Returns the line vhea provides, where the font has one.
A vertical line runs across the page, so its measurements scale along x where a horizontal line’s scale along y.
Sourcepub fn x_height(&self) -> Option<S::Value>
pub fn x_height(&self) -> Option<S::Value>
Returns the height of a lowercase letter, where the font provides one.
Sourcepub fn cap_height(&self) -> Option<S::Value>
pub fn cap_height(&self) -> Option<S::Value>
Returns the height of a capital letter, where the font provides one.
Sourcepub fn max_h_advance(&self) -> Option<S::Value>
pub fn max_h_advance(&self) -> Option<S::Value>
Returns the widest advance in the font, where it provides one.
Sourcepub fn max_v_advance(&self) -> Option<S::Value>
pub fn max_v_advance(&self) -> Option<S::Value>
Returns the tallest advance in the font, where it provides one.
Sourcepub fn average_char_width(&self) -> Option<S::Value>
pub fn average_char_width(&self) -> Option<S::Value>
Returns the average advance in the font, where it provides one.
Sourcepub fn win_line(&self) -> Option<LineExtents<S::Value>>
pub fn win_line(&self) -> Option<LineExtents<S::Value>>
Returns the line outside which the font asks not to be clipped.
fn scale_line_y(&self, line: LineBox<F48Dot16>) -> LineBox<S::Value>
fn scale_line(&self, line: LineExtents<F48Dot16>) -> LineExtents<S::Value>
fn scaled_y(&self, value: Option<F48Dot16>) -> Option<S::Value>
Trait Implementations§
Source§impl<'a, S: Clone + Scale> Clone for ScaledMetrics<'a, S>
impl<'a, S: Clone + Scale> Clone for ScaledMetrics<'a, S>
Source§fn clone(&self) -> ScaledMetrics<'a, S>
fn clone(&self) -> ScaledMetrics<'a, S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more