pub struct Typeface { /* private fields */ }Expand description
Typeface is one face the platform matched: a font file, the face’s index in it, and
how the platform names and styles that face.
The bytes are shared, so many typefaces from one collection file carry one copy. A variable font is one typeface; its instances are the parser’s to enumerate.
Implementations§
Source§impl Typeface
impl Typeface
pub fn new( data: Arc<dyn AsRef<[u8]> + Send + Sync>, index: u32, family: impl Into<String>, style: Style, ) -> Typeface
shared_data is the file’s bytes as a font parser shares them.
Sourcepub fn index(&self) -> u32
pub fn index(&self) -> u32
index is the face’s position in a collection file; 0 in a single-face file.
pub fn style(&self) -> Style
Sourcepub fn covers(&self, character: char) -> bool
pub fn covers(&self, character: char) -> bool
covers reports whether the face has a glyph for character.
Sourcepub fn tables(&self) -> Vec<(Tag, &[u8])>
pub fn tables(&self) -> Vec<(Tag, &[u8])>
tables is what a platform serves of this face: its tables in the file’s order,
without the outline and color-glyph tables, which stay with the platform and are
rasterized on request. A consumer rebuilds a font from them with assemble.
Empty when the file does not parse.