Skip to main content

Read, write and generate UFOs with designspace data.

Project description

PyPI

ufoProcessor

Python package based on the designSpaceDocument from fontTools.designspaceLib) specifically to process and generate instances for UFO files, glyphs and other data.

UFOOperator takes over from UfoProcessor

Some deep changes were necessary to support designspace format 5 files. Rather than try to work it into unwilling old code, UFOOperator is rewritten from the bottom up. The new object wraps the FontTools DesignSpaceDocument object, rather than subclassing it. The goals for UFOOperator remain largely the same. Though the emphasis is now on providing objects that provide live interpolation, rather than generate stand alone UFOs.

  • Support designspace format 5, with layers. Not all elements of designspace 5 are supported.
  • Collect source materials
  • Provide mutators for specific glyphs, font info, kerning so that other tools can generate partial instances. Either from MutatorMath or fonttools varlib.model.
  • Support anisotropic locations in both math models, even if Variable Fonts won't. These are super useful during design, so I need them to work.
  • Support extrapolation in both math models, even if Variable Fonts won't. Note that MutatorMath and VarLib approach extrapolation differently. Useful for design-explorations.
  • Support discrete axes. This is a bit complex, but it is nice when it works.
  • Apply avar-like designspace bending
  • Generate actual UFO instances in formats 3.
  • Round geometry as requested
  • Try to stay up to date with fontTools
  • Baseclass for tools that need access to designspace data.
  • Some caching of MutatorMath and Varlib flavored mutators.

No more rules

UFOProcessor could execute some of the feature-variation rules when it generated UFOs. But these variations has become much more complex than can be faked with simple glyph-swapping. So I did not port that to UFOOperator. UFOs generated with UFOOperator will have all the glyphs in the same places as their sources.

Discrete axes

A discrete axis is a way to fit different interpolating systems into a single designspace. For instance a roman could be on italic=0 and the italic on italic=1. The roman and italic are in the same file, but to UFOOperator they are separate systems that interpolate along the normal axes. If is are more than one discrete axis in a designspace, each combination of the axis values, each discrete location can be an interpolating system. So some of the methods of UFOOperator require a discrete location to know which interpolating system is needed.

Examples UFOProcessor (old)

Generate all the instances (using the varlib model, no rounding):

import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath)

Generate all the instances (using the varlib model, but round all the geometry to integers):

import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath, roundGeometry=True)

Generate all the instances (using the mutatormath model, no rounding):

import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath, useVarlib=False)

Generate an instance for one glyph, "A" at width=100, weight=200. (assuming the designspace has those axes and the masters have that glyph)

import ufoProcessor
myPath = "myDesignspace.designspace"
doc = ufoProcessor.DesignSpaceProcessor()
doc.read(myPath)
doc.loadFonts()
glyphMutator = doc.getGlyphMutator("A")
instance = glyphMutator.makeInstance(Location(width=100, weight=200)

Depending on the setting for usevarlib, the glyphMutator object returned by getGlyphMutator in the example above can either be a MutatorMath.Mutator, or a VariationModelMutator object. That uses the fontTools.varLib.models.VariationModel but it is wrapped and can be called as a Mutator object to generate instances. This way DesignSpaceProcessor does not need to know much about which math model it is using.

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

ufoprocessor-1.14.1.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ufoprocessor-1.14.1-py2.py3-none-any.whl (38.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ufoprocessor-1.14.1.tar.gz.

File metadata

  • Download URL: ufoprocessor-1.14.1.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ufoprocessor-1.14.1.tar.gz
Algorithm Hash digest
SHA256 fd38d3cc359b94171ba8d3fdc1e4defde2206acef4f97d75b48503bb8ac03b01
MD5 018302487e448ecbbab17044e5a08b30
BLAKE2b-256 73867564e3b6ff396372c4eb444181c5446f19a8bfa83cdb9f8ee1c8f1fa0de0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ufoprocessor-1.14.1.tar.gz:

Publisher: release.yml on LettError/ufoProcessor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ufoprocessor-1.14.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ufoprocessor-1.14.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ufoprocessor-1.14.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bfb5521dae1d25181d0514d786d5a515d1f17bb3f097e253c9c53b3187cb21f7
MD5 962e30f4c624590a1d33a958b8f6559e
BLAKE2b-256 451560f9933bcaa1c525d130fd4675053ab471274822913f9c57a324c519f3ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for ufoprocessor-1.14.1-py2.py3-none-any.whl:

Publisher: release.yml on LettError/ufoProcessor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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