Trait printpdf::FontData

source ·
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§

source

fn font_metrics(&self) -> FontMetrics

Returns the unscaled metrics for this font.

source

fn glyph_id(&self, c: char) -> Option<u16>

Returns the glyph id for a Unicode character if it is present in this font.

source

fn glyph_ids(&self) -> HashMap<u16, char>

Returns a mapping from glyph IDs to Unicode characters for all supported characters.

source

fn glyph_count(&self) -> u16

Returns the number of glyphs in this font.

source

fn glyph_metrics(&self, glyph_id: u16) -> Option<GlyphMetrics>

Returns the glyph metrics for a glyph of this font, if available.

Trait Implementations§

source§

impl Clone for Box<dyn FontData>

source§

fn clone(&self) -> Box<dyn FontData>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§