Skip to main content

Python library for manipulating OpenType font features

Project description

# fontFeatures: Python library for manipulating OpenType font features

OpenType fonts are “programmed” using features, which are normally authored in Adobe’s [feature file format](http://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html). 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](https://simoncozens.github.io/fonts-and-layout/features.html#how-features-are-stored). 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:

  • features can be represented in a structured human-readable and machine-readable way, analogous to the XML files of the [Unified Font Object](http://unifiedfontobject.org/) format.

  • features can be more directly authored by programs (such as font editors), rather than them having to output AFDKO feature file format.

  • features can be easily manipulated by programs - for example, features from two files merged together, or lookups moved between languages.

> 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:

  • fontFeatures itself, which is an abstract representation of the different layout operations inside a font.

  • fontFeatures.feaLib (included as a mixin) which translates between Adobe feature syntax and fontFeatures representation.

  • fontFeatures.ttLib, which translates between OpenType binary fonts and fontFeatures representation. (Currently only OTF -> fontFeatures is partially implemented; there is no fontFeatures -> OTF compiler yet.)

  • fontFeatures.feeLib which parses a new, extensible format called FEE for font engineering.

  • fontFeatures.fontDameLib which translate FontDame text files into fontFeatures objects.

And the following utilities:

  • fee2fea: translates a FEE file into Adobe feature syntax.

  • otf2fea: translates an OTF file into Adobe features syntax.

  • txt2fea: translates a FontDame txt file into Adobe features syntax.

  • mergeFee: takes an existing font, adds FEE rules to it, and writes it out again.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fontFeatures-1.0.0.tar.gz (79.6 kB view details)

Uploaded Source

Built Distribution

fontFeatures-1.0.0-py3-none-any.whl (105.2 kB view details)

Uploaded Python 3

File details

Details for the file fontFeatures-1.0.0.tar.gz.

File metadata

  • Download URL: fontFeatures-1.0.0.tar.gz
  • Upload date:
  • Size: 79.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for fontFeatures-1.0.0.tar.gz
Algorithm Hash digest
SHA256 622a1d2ff0be579d2a87802405d11c0c7c2f114182522df68c5db14ca1f0ca71
MD5 13a880adc96652fe4153e2d576a03fab
BLAKE2b-256 c2e01acd72bff99a8c0fce74bbe2fca30319aa975d252585bf857c91a5716a83

See more details on using hashes here.

File details

Details for the file fontFeatures-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fontFeatures-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 105.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for fontFeatures-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4444e21dba5b2a38caa2ee5a0ee2c2ae17ea06221dce55d8aeb3ae347d9f201d
MD5 312097de2d434a3131357a2b6f25ba38
BLAKE2b-256 ebe4a596cc32953203b9130ae25dbb2ab45ab527875f8067176992adb8ac94bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page