simoncozens / fontFeatures

Python library for manipulating OpenType font features
BSD 3-Clause "New" or "Revised" License
73 stars 10 forks source link

fontFeatures library

If you're looking for the FEE language, it has been renamed to FEZ and moved to its own library (fez).

OpenType fonts are "programmed" using features, which are normally authored in Adobe's feature file format. This like source code to a computer program: it's a user-friendly, but computer-unfriendly, way to represent the features.

Inside a font, the features are compiled in an efficient internal format. This is like the binary of a computer program: computers can use it, but they can't do else anything with it, and people can't read it.

The purpose of this library is to provide a middle ground for representing features in a machine-manipulable format, kind of like the abstract syntax tree of a computer programmer. This is so that:

How is this different from fontTool's feaLib? I'm glad you asked. feaLib translates between the Adobe feature file format and a abstract syntax tree representing elements of the feature file - not representing the feature data. The AST is still "source equivalent". For example, when you code an aalt feature in feature file format, you might include code like feature salt to include lookups from another feature. But what's actually meant by that is a set of lookups. fontFeatures allows you to manipulate meaning, not description.

Components

fontFeatures consists of the following components:

And the following utilities: