Trait MetadataProvider

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: NameId) -> 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 color_palettes(&self) -> ColorPalettes<'a>;
    fn bitmap_strikes(&self) -> BitmapStrikes<'a>;
}
Expand description

Interface for types that can provide font metadata.

Required Methods§

fn attributes(&self) -> Attributes

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

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

Returns the collection of variation axes.

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

Returns the collection of named variation instances.

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

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

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

Returns the mapping from glyph identifiers to names.

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.

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.

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

Returns the character to nominal glyph identifier mapping.

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.

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

Returns a collection of paintable color glyphs.

fn color_palettes(&self) -> ColorPalettes<'a>

Returns a collection of color palettes for color glyphs.

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§

§

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