@simoncozens/fonttypes
    Preparing search index...

      @simoncozens/fonttypes

      This is fonttypes, a TypeScript library for font engineering. It will be primarily useful for people working with variable fonts, especially at the source level; it includes types for designspaces, coordinates, locations, variation models, and provides utility functions for OpenType interpolation.

      Coordinates And Locations - Coordinate Spaces

      Marker types representing different coordinate spaces. You probably won't use these directly, but use the type aliases which use these as type parameters instead.

      Designspace

      The design coordinate space

      Normalized

      The normalized coordinate space

      Space

      A union of all coordinate spaces

      Userspace

      The user coordinate space

      Coordinates And Locations - Coordinates

      Types representing individual coordinate values in different spaces. By applying typings to these coordinates, it becomes impossible to mix them up accidentally. For example

      const defaultValue: UserspaceCoordinate = 400;
      const min: DesignspaceCoordinate = 24;
      const max: UserspaceCoordinate = 900;
      const axis: Axis = {
      tag: 'wght',
      name: 'Weight',
      min, // Won't compile, type error
      max,
      default: defaultValue
      };
      Coordinate

      A coordinate in a specific coordinate space

      DesignspaceCoordinate

      A coordinate in design space

      NormalizedCoordinate

      A coordinate in normalized space

      UserspaceCoordinate

      A coordinate in user space

      toNormalized

      Create a normalized space coordinate, clamped to -1.0 to 1.0

      Coordinates And Locations - Locations

      Types representing mappings of axis names to coordinates, hence representing a location in some coordinate space; for example:

      const location1: DesignspaceLocation = {wght: 120, wdth: 1};
      const location2: UserspaceLocation = {wght: 400, wdth: 75};
      DesignspaceLocation

      A location in design space

      Location

      A location, in some coordinate space

      NormalizedLocation

      A location in normalized space

      UserspaceLocation

      A location in user space

      Coordinates And Locations - Mapping Between Coordinate Spaces

      Types and functions to help move between different coordinate spaces.

      DesignspaceToUserspaceMapping

      An array which maps design space coordinates to user space coordinates

      Mapping

      A piecewise linear mapping between coordinate spaces

      UserspaceToDesignspaceMapping

      An array which maps user space coordinates to design space coordinates

      designspaceToUserspace

      Convert a designspace location to a userspace location

      normalizeLocation

      Convert a designspace location to a normalized location

      normalizeValue

      Normalize a designspace coordinate to normalized space

      piecewiseLinearMap

      Map a coordinate between spaces

      userspaceToDesignspace

      Convert a userspace location to a designspace location

      Font source objects

      Axis

      A variable font axis

      Interpolation and Variation Models - Variation models

      VariationModel

      Represents an OpenType variation model for a set of masters

      Support

      Represents the support region of a master in a variation model

      supportScalar

      Return the support scalar for a given location and support