Skip to main content

OwnedFontMetrics

Type Alias OwnedFontMetrics 

Source
pub type OwnedFontMetrics = FontMetrics<'static>;
Expand description

Convenience alias for fully-owned metrics ('static).

§Examples

use adobe_font_metrics::{OwnedFontMetrics, parse};

let src = "StartFontMetrics 4.1\nFontName Demo\nFontBBox 0 0 1000 1000\nEndFontMetrics\n";
let metrics: OwnedFontMetrics = parse(src)?.into_owned();

assert_eq!(metrics.font_name, "Demo");

Aliased Type§

pub struct OwnedFontMetrics {
Show 16 fields pub font_name: Cow<'static, str>, pub full_name: Cow<'static, str>, pub family_name: Cow<'static, str>, pub weight: Cow<'static, str>, pub italic_angle: f32, pub is_fixed_pitch: bool, pub font_bbox: BBox, pub underline_position: f32, pub underline_thickness: f32, pub cap_height: f32, pub x_height: f32, pub ascender: f32, pub descender: f32, pub encoding_scheme: Cow<'static, str>, pub character_metrics: Cow<'static, [CharacterMetric<'static>]>, pub kerning_pairs: Cow<'static, [KerningPair<'static>]>,
}

Fields§

§font_name: Cow<'static, str>

PostScript FontName (e.g. "Helvetica").

§full_name: Cow<'static, str>

Human-readable FullName (e.g. "Helvetica Bold Oblique").

§family_name: Cow<'static, str>

PostScript FamilyName (e.g. "Helvetica").

§weight: Cow<'static, str>

Weight token, free-form per the spec ("Medium", "Bold", etc.).

§italic_angle: f32

Italic angle in degrees, counter-clockwise from vertical.

§is_fixed_pitch: bool

true if every glyph has the same advance width.

§font_bbox: BBox

Bounding box that contains every glyph in the font.

§underline_position: f32

Recommended y position of the underline, in 1/1000 em.

§underline_thickness: f32

Recommended thickness of the underline, in 1/1000 em.

§cap_height: f32

Height of an unaccented capital, in 1/1000 em.

§x_height: f32

Height of a lowercase x, in 1/1000 em.

§ascender: f32

Ascender height, in 1/1000 em.

§descender: f32

Descender depth (negative for descents below the baseline).

§encoding_scheme: Cow<'static, str>

Encoding scheme name (e.g. "AdobeStandardEncoding").

§character_metrics: Cow<'static, [CharacterMetric<'static>]>

Per-glyph metrics. parse always returns this as Cow::Owned; Cow::Borrowed(&'static [...]) is reserved for compile-time-baked statics in downstream crates (e.g. pdf-base14-metrics).

§kerning_pairs: Cow<'static, [KerningPair<'static>]>

Kerning pairs. parse always returns this as Cow::Owned; Cow::Borrowed(&'static [...]) is reserved for compile-time-baked statics in downstream crates (e.g. pdf-base14-metrics).