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>,
}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>Union of minimum and maximum extents for all glyphs in the font.