pub struct StyleMetrics {
pub units_per_em: u16,
pub subscript: Option<ScriptMetrics>,
pub superscript: Option<ScriptMetrics>,
pub underline: Option<Decoration>,
pub strike_through: Option<Decoration>,
pub italic_angle: Option<Fixed>,
pub is_fixed_pitch: Option<bool>,
}Expand description
Font-wide style measurements from OS/2 and post, or Type 1 font info.
Unlike super::Metrics, reading these may require the post table.
Each group is None if its source table is missing or unreadable. At a
non-default location, MVAR deltas are applied without rounding. The italic
angle remains the value in post; normalized coordinates alone do not
provide the user-space slnt value needed to adjust it.
Fields§
§units_per_em: u16Design units per em, which the measurements use.
The same as Metrics::units_per_em.
subscript: Option<ScriptMetrics>Suggested subscript em box and placement, from OS/2.
superscript: Option<ScriptMetrics>Suggested superscript em box and placement, from OS/2.
underline: Option<Decoration>Suggested underline, from post.
strike_through: Option<Decoration>Suggested strikethrough, from OS/2.
italic_angle: Option<Fixed>Italic angle in degrees, from post. This is not a length.
is_fixed_pitch: Option<bool>Whether post reports a fixed pitch.
Implementations§
Source§impl StyleMetrics
impl StyleMetrics
Sourcepub fn scaled<S: Scale>(&self, scale: S) -> ScaledStyleMetrics<'_, S>
pub fn scaled<S: Scale>(&self, scale: S) -> ScaledStyleMetrics<'_, S>
Returns these style measurements in the units scale describes.
Sourcepub fn scaled_f32(&self, ppem: f32) -> ScaledStyleMetrics<'_, ScaleF32>
pub fn scaled_f32(&self, ppem: f32) -> ScaledStyleMetrics<'_, ScaleF32>
Returns these style measurements in pixels at ppem, as f32.
Sourcepub fn scaled_26dot6(&self, ppem: f32) -> ScaledStyleMetrics<'_, Scale26Dot6>
pub fn scaled_26dot6(&self, ppem: f32) -> ScaledStyleMetrics<'_, Scale26Dot6>
Returns these style measurements in pixels at ppem, in 26.6 fixed
point.
Source§impl StyleMetrics
impl StyleMetrics
Sourcepub fn from_sfnt<'a>(
tables: &impl TableProvider<'a>,
normalized_coords: &[NormalizedCoord],
) -> Self
pub fn from_sfnt<'a>( tables: &impl TableProvider<'a>, normalized_coords: &[NormalizedCoord], ) -> Self
Reads style measurements from tables at normalized_coords.
Pass an empty location for the font’s defaults. Missing or unreadable tables leave their measurements unset.
Sourcepub fn from_type1(font: &Type1Font) -> Self
pub fn from_type1(font: &Type1Font) -> Self
Reads the style measurements from a Type 1 font.
Its underline center is converted to the top edge used by
Decoration. Type 1 has no subscript, superscript or strikethrough.
Sourcepub fn from_cff(font: &CffFontRef<'_>) -> Self
pub fn from_cff(font: &CffFontRef<'_>) -> Self
Reads style measurements from a standalone CFF font.
Trait Implementations§
Source§impl Clone for StyleMetrics
impl Clone for StyleMetrics
Source§fn clone(&self) -> StyleMetrics
fn clone(&self) -> StyleMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more