Skip to main content

CI Build Status PyPI Version Python Versions

UFO Extractor

Tools for extracting data from font binaries into UFO objects.

Supported input formats

The following font formats are supported:

  • CFF or TrueType-flavored OpenType fonts (*.otf, *.ttf)

  • FontTools TTX files (*.ttx)

  • WOFF 1.0/2.0 (*.woff, *.woff2)

  • PostScript Type1 fonts (*.pfa, *.pfb, etc.)

  • FontLab files (*.vfb, when installed with optional dependency “vfb”)

Note however, that what data will (or even could) be exported will depend on input file format and the file itself.

Python module

The example below demonstrates how one can import data into a ufoLib2 or Defcon Font instance:

>>> import extractor
>>> from ufoLib2 import Font    # alternatively: from defcon import Font
>>> ufo = Font()
>>> extractor.extractUFO("/path/to/MyFont.ttf", ufo)
>>> ufo.save("/path/to/MyFont.ufo")

Console script

A console script for one-off conversion is also provided (note: see Installation below):

$ extractufo -h
usage: extractufo [-h] [-m {ufoLib2,defcon}] [-z] FONT_FILE [FONT_FILE ...]

Extract data from font binaries and build UFO objects from them.

positional arguments:
  FONT_FILE             Input font path

options:
  -h, --help            show this help message and exit
  -m {ufoLib2,defcon}, --ufo-module {ufoLib2,defcon}
                        Select the default library for writing UFOs (default: autodetect, prefer ufoLib2)
  -z, --zip             Output UFO ZIP

Each resulting UFO will be saved as FONT_FILE.ufo(z) in the same directory as the original FONT_FILE.
If destination file or directory already exists, conversion for that source file will be skipped and the application exit code will indicate an error.

Installation

You can install extractor with pip:

$ pip install ufo-extractor

To install with support for extracting from vfb files:

$ pip install ufo-extractor[vfb]

If you want to use the console script and have neither ufoLib2 nor defcon installed (or aren’t sure), running the following will install ufoLib2 as well to ensure that the script works:

$ pip install ufo-extractor[script]

The options may also be combined:

$ pip install ufo-extractor[vfb][script]

Note that, for historical reasons, the package is listed on the Python Package Index under the name ufo-extractor, to disambiguate it from another package also called “extractor”. However, the import name for the package remains extractor, without prefix.

Release files for ufo-extractor 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ufo-extractor 0.8.1
File Size Uploaded
ufo_extractor-0.8.1.zip 3.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ufo-extractor 0.8.1
File Interpreter ABI Platform
ufo_extractor-0.8.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 3.1 MB

Release files / ufo_extractor-0.8.1.zip

Download URL ufo_extractor-0.8.1.zip
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
e4c2ba3458dcc0ee203a3a16d886f3736e50c36b5a4e906b97e5dcc486e1863d
BLAKE2b-256 checksum
How to use checksums
2d3b22225ded69f50bc61840d88c9bcaa852eb8a27a4be8a3a41c9d58a7cad42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / ufo_extractor-0.8.1-py2.py3-none-any.whl

Download URL ufo_extractor-0.8.1-py2.py3-none-any.whl
Size 24.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8b3b0bb2d81f7802203e940851b07ce4559b67d627ef33034e8bbd8fad66d5a7
BLAKE2b-256 checksum
How to use checksums
cdcf34b74c79439ac47ee16e129b709b1fe61ef20211175ac358a252ae50dd3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page