GitHub - LettError/MutatorMath: Python library for piecewise linear interpolation in multiple dimensions with multiple, arbitrarily placed, masters. (original) (raw)

Build Status Coverage Status PyPI Version

MutatorMath

A MutatorMath Colorfield

A MutatorMath Colorfield

MutatorMath is a Python library for the calculation of piecewise linear interpolations in n-dimensions with any number of masters. It was developed for interpolating data related to fonts, but if can handle any arithmetic object.

License

The MutatorMath package is published under the BSD-3 license.

Dependencies

The basic Mutator and Location objects will run on any standard Python 2.7 or higher distribution, and is been tested on Python 3.5 or higher.

The UFO processing tools in MutatorMath need some additional libraries.

Library Author URL
FontTools FontTools https://github.com/fonttools/fonttools
Defcon TypeSupply.com https://github.com/typesupply/defcon
FontMath TypeSupply.com https://github.com/typesupply/fontMath

MutatorMath terminology

An explanation with colorful graphs of how the MutatorMath calculates the factors.

Building a Mutator

A convenient Mutator builder function buildMutator() accepts a list of (location, object) pairs. Internally it sorts the neutral / on / off axis masters and calculates the bias.

UFO

A UFO stores data related to the design and production of fonts (specification atUnifiedFontObject.org. The ufo/ subpackage contains some tools to make the building and processing of UFO mutators easier.

Designspace document

The requirements for a UFO designspace will differ from project to project. The location of the masters and instances, special wishes for kerning and specific glyphs etc. This package provides tools to read and write a description of a designspace to XML. Such a file stores all information necessary: which source UFOs, where to insert them, which glyphs to generate, which instances etc.

Designspace XML structure

A .designspace file contains all data needed for setting up interpolations between a number of master UFOs. A detailed description of the designspace format here: designspace file format

Writing a designspace

⚠️ WARNING: the DesignSpaceDocumentWriter and DesignSpaceDocumentReader are quite old, head to ufoProcessor if you need to process and generate UFO instances.

DesignSpaceDocumentWriter object writes an XML representation of a designspace.

Reading a designspace

DesignSpaceDocumentReader reads a DesignSpaceDocument. First it will look for all UFO masters and then it will build all instances.

DesignSpaceDocumentReader assumes all paths for sources and instances are relative to the documentPath.

Thanks