pub trait FontData: FontDataClone + Debug {
// Required methods
fn font_metrics(&self) -> FontMetrics;
fn glyph_id(&self, c: char) -> Option<u16>;
fn glyph_ids(&self) -> HashMap<u16, char>;
fn glyph_count(&self) -> u16;
fn glyph_metrics(&self, glyph_id: u16) -> Option<GlyphMetrics>;
}
Expand description
Provides access to font metrics.
Per default, printpdf uses owned_ttf_parser
to extract the font data. You can implement
this trait for other types if you want to use a different font backend.
Required Methods§
sourcefn font_metrics(&self) -> FontMetrics
fn font_metrics(&self) -> FontMetrics
Returns the unscaled metrics for this font.
sourcefn glyph_id(&self, c: char) -> Option<u16>
fn glyph_id(&self, c: char) -> Option<u16>
Returns the glyph id for a Unicode character if it is present in this font.
sourcefn glyph_ids(&self) -> HashMap<u16, char>
fn glyph_ids(&self) -> HashMap<u16, char>
Returns a mapping from glyph IDs to Unicode characters for all supported characters.
sourcefn glyph_count(&self) -> u16
fn glyph_count(&self) -> u16
Returns the number of glyphs in this font.
sourcefn glyph_metrics(&self, glyph_id: u16) -> Option<GlyphMetrics>
fn glyph_metrics(&self, glyph_id: u16) -> Option<GlyphMetrics>
Returns the glyph metrics for a glyph of this font, if available.