Module for dealing with ‘gvar’-style font variations, also known as run-time interpolation.

The ideas here are very similar to MutatorMath. There is even code to read MutatorMath .designspace files in the varLib.designspace module.

For now, if you run this file on a designspace file, it tries to find ttf-interpolatable files for the masters and build a variable-font from them. Such ttf-interpolatable and designspace files can be generated from a Glyphs source, eg., using noto-source as an example:

$ fontmake -o ttf-interpolatable -g NotoSansArabic-MM.glyphs

Then you can make a variable-font this way:

$ fonttools varLib master_ufo/NotoSansArabic.designspace

API will change in near future.

class fontTools.varLib.MasterFinder(template)[source], master_finder=<function <lambda>>, exclude=[], optimize=True)[source]

Build variation font from a designspace file.

If master_finder is set, it should be a callable that takes master filename as found in designspace file and map it to master font binary as to be opened (eg. .ttf or .otf).

fontTools.varLib.load_masters(designspace, master_finder=<function <lambda>>)[source]

Ensure that all SourceDescriptor.font attributes have an appropriate TTFont object loaded, or else open TTFont objects from the SourceDescriptor.path attributes.

The paths can point to either an OpenType font, a TTX file, or a UFO. In the latter case, use the provided master_finder callable to map from UFO paths to the respective master font binaries (e.g. .ttf, .otf or .ttx).

Return list of master TTFont objects in the same order they are listed in the DesignSpaceDocument.


Build a variable font from a designspace file and masters

fontTools.varLib.set_default_weight_width_slant(font, location)[source]