Trait MetadataProvider

Source
pub trait MetadataProvider<'a>: Sized {
    // Required methods
    fn attributes(&self) -> Attributes;
    fn axes(&self) -> AxisCollection<'a>;
    fn named_instances(&self) -> NamedInstanceCollection<'a>;
    fn localized_strings(&self, id: StringId) -> LocalizedStrings<'a> ;
    fn glyph_names(&self) -> GlyphNames<'a>;
    fn metrics(
        &self,
        size: Size,
        location: impl Into<LocationRef<'a>>,
    ) -> Metrics;
    fn glyph_metrics(
        &self,
        size: Size,
        location: impl Into<LocationRef<'a>>,
    ) -> GlyphMetrics<'a>;
    fn charmap(&self) -> Charmap<'a>;
    fn outline_glyphs(&self) -> OutlineGlyphCollection<'a>;
    fn color_glyphs(&self) -> ColorGlyphCollection<'a>;
    fn bitmap_strikes(&self) -> BitmapStrikes<'a>;
}
Expand description

Interface for types that can provide font metadata.

Required Methods§

Source

fn attributes(&self) -> Attributes

Returns the primary attributes for font classification– stretch, style and weight.

Source

fn axes(&self) -> AxisCollection<'a>

Returns the collection of variation axes.

Source

fn named_instances(&self) -> NamedInstanceCollection<'a>

Returns the collection of named variation instances.

Source

fn localized_strings(&self, id: StringId) -> LocalizedStrings<'a>

Returns an iterator over the collection of localized strings for the given informational string identifier.

Source

fn glyph_names(&self) -> GlyphNames<'a>

Returns the mapping from glyph identifiers to names.

Source

fn metrics(&self, size: Size, location: impl Into<LocationRef<'a>>) -> Metrics

Returns the global font metrics for the specified size and location in normalized variation space.

Source

fn glyph_metrics( &self, size: Size, location: impl Into<LocationRef<'a>>, ) -> GlyphMetrics<'a>

Returns the glyph specific metrics for the specified size and location in normalized variation space.

Source

fn charmap(&self) -> Charmap<'a>

Returns the character to nominal glyph identifier mapping.

Source

fn outline_glyphs(&self) -> OutlineGlyphCollection<'a>

Returns the collection of scalable glyph outlines.

If the font contains multiple outline sources, this method prioritizes glyf, CFF2 and CFF in that order. To select a specific outline source, use the OutlineGlyphCollection::with_format method.

Source

fn color_glyphs(&self) -> ColorGlyphCollection<'a>

Source

fn bitmap_strikes(&self) -> BitmapStrikes<'a>

Returns a collection of bitmap strikes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> MetadataProvider<'a> for FontRef<'a>