VariationInfo

Trait VariationInfo 

Source
pub trait VariationInfo {
    type Error: Error;

    // Required methods
    fn axis_count(&self) -> u16;
    fn axis(&self, axis_tag: Tag) -> Option<(usize, &Axis)>;
    fn resolve_variable_metric(
        &self,
        locations: &HashMap<NormalizedLocation, i16>,
    ) -> Result<(i16, Vec<(VariationRegion, i16)>), Self::Error>;
    fn resolve_glyphs_number_value(
        &self,
        name: &str,
    ) -> Result<HashMap<NormalizedLocation, f64>, Self::Error>;
}
Expand description

A trait for providing variable font information to the compiler.

In order to compile a variable font, we need to know what axes exist, what ranges are valid, how to map from user to normalized coordinates, and potentially other things that are not part of the FEA file.

This trait abstracts over that info.

Required Associated Types§

Source

type Error: Error

The error type

Required Methods§

Source

fn axis_count(&self) -> u16

The number of axes in the fvar table

Source

fn axis(&self, axis_tag: Tag) -> Option<(usize, &Axis)>

If the tag is an axis in this font, it’s fvar index and it’s Axis data.

Source

fn resolve_variable_metric( &self, locations: &HashMap<NormalizedLocation, i16>, ) -> Result<(i16, Vec<(VariationRegion, i16)>), Self::Error>

Compute default & deltas for a set of locations and values in variation space.

On success, returns the default value for this set of locations, as well as a set of deltas suitable for inclusing in an ItemVariationStore.

Source

fn resolve_glyphs_number_value( &self, name: &str, ) -> Result<HashMap<NormalizedLocation, f64>, Self::Error>

Glyphsapp only: return the [number value] for this name, if defined:

Implementors§