pub enum GlyphSource {
Fontations(Face),
Type1(Arc<Type1Font>),
None,
}Expand description
Where glyphs come from.
Fontations covers TrueType, bare CFF, OpenType and everything else with a
table directory; Type1 covers PFA/PFB programs and the two Multiple-Master
fallback faces; None is a Type3 font or a program nothing could read.
Variants§
Fontations(Face)
A face read by skrifa, over bytes this value owns.
Type1(Arc<Type1Font>)
A Type 1 program, optionally instantiated at design coordinates.
None
No glyphs at all.
Implementations§
Source§impl GlyphSource
impl GlyphSource
Sourcepub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Option<Self>
pub fn from_bytes(bytes: impl Into<Arc<[u8]>>) -> Option<Self>
Open a TrueType, OpenType, bare-CFF, or Type 1 program from its bytes.
None when no backend recognises the blob.
Sourcepub fn units_per_em(&self) -> u16
pub fn units_per_em(&self) -> u16
Design units per em; 0 when there is no face.
Sourcepub fn num_glyphs(&self) -> u32
pub fn num_glyphs(&self) -> u32
How many glyphs the face declares.
Sourcepub fn is_truetype(&self) -> bool
pub fn is_truetype(&self) -> bool
Is this a TrueType-shaped face? PDFium’s per-glyph fallback and its
ShouldUseFont test both branch on it.
Sourcepub fn char_index(&self, charmap: Charmap, code: u32) -> u16
pub fn char_index(&self, charmap: Charmap, code: u32) -> u16
The glyph a character code selects through the face’s currently selected charmap.
Returns 0 rather than None on a miss, because every ladder in the former working note
and the former working note tests != 0 and 0 is .notdef either way.
Sourcepub fn charmaps(&self) -> Vec<CharmapId>
pub fn charmaps(&self) -> Vec<CharmapId>
The charmaps the face declares, as (platform, encoding) pairs in
table order.
Sourcepub fn default_advance(&self, gid: Gid) -> i32
pub fn default_advance(&self, gid: Gid) -> i32
Advance in 1000/em units at the face’s default location.
Sourcepub fn postscript_name(&self) -> Option<String>
pub fn postscript_name(&self) -> Option<String>
PostScript name, or a family/style display name, when the face has one.
Sourcepub fn is_fixed_pitch(&self) -> bool
pub fn is_fixed_pitch(&self) -> bool
Fixed pitch: post.isFixedPitch, or Type 1 /isFixedPitch.
Sourcepub fn is_italic(&self) -> bool
pub fn is_italic(&self) -> bool
Italic: OS/2 / macStyle / post.italicAngle, or a Type 1 /ItalicAngle.
Sourcepub fn cap_height_unscaled(&self) -> Option<f32>
pub fn cap_height_unscaled(&self) -> Option<f32>
OS/2 sCapHeight in font units, when present.
Sourcepub fn unscaled_ascent(&self) -> Option<i32>
pub fn unscaled_ascent(&self) -> Option<i32>
Ascender in font units (hhea, or the Type 1 bbox top).
Sourcepub fn unscaled_descent(&self) -> Option<i32>
pub fn unscaled_descent(&self) -> Option<i32>
Descender in font units (hhea, or the Type 1 bbox bottom).
Trait Implementations§
Source§impl Clone for GlyphSource
impl Clone for GlyphSource
Source§fn clone(&self) -> GlyphSource
fn clone(&self) -> GlyphSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more