Applies STAT information from a Stylespace to a variable font.
Project description
statmake
statmake takes a user-written Stylespace that defines OpenType STAT information for an entire font family and then (potentially subsets and) applies it to a specific variable font. This spares users from having to deal with raw TTX dumps and juggling with nameIDs.
Installation
The easiest way is by installing it with pip. You need at least Python 3.8.
pip3 install statmake
Usage
External Stylespace file, stand-alone or referenced from a Designspace file
If you are producing more than one variable font (i.e. you have multiple Designspace files), you can avoid duplicated information by writing a single all-encompassing Stylespace file which statmake will subset for each variable font.
Attention: A STAT table is supposed to describe a font's relationship to the entire family. If you have separate upright and italic variable fonts with a wght axis each, you need to mark each font's position on the ital axis in the Designspace lib org.statmake.additionalLocations key. The Designspace <axes> elements are not supposed to hold this information, so it must be done in a separate lib key.
- Write a Stylespace file that describes each stop of all axes available in the entire family. See tests/data/Test.stylespace for an annotated example. You can also use it as a starting point.
- You can have the file stand-alone or use the Designspace lib's
org.statmake.stylespacePathkey to store the path to the Stylespace file relative to the Designspace file. See tests/data/TestExternalStylespace.designspace for an example. - If you have one or more Designspace files which do not define all axes available to the family, you have to annotate them with the missing axis locations to get a complete
STATtable. See the lib key at the bottom of tests/data/Test_Wght_Upright.designspace and tests/data/Test_Wght_Italic.designspace for an example. - Generate the variable font(s) as normal
- If...
- ... you store the Stylespace file stand-alone: run
statmake --designspace variable_font.designspace --stylespace your.stylespace variable_font.ttf. - ... you store the Stylespace inline in the Designspace file or as a stand-alone file and added the relative path to it in the Designspace's
org.statmake.stylespacePathkey: runstatmake --designspace variable_font.designspace variable_font.ttf
- ... you store the Stylespace file stand-alone: run
Be sure to use the Designspace file that was used to generate the font to get the correct missing axis location definitions.
Designspace file with inline Stylespace data
If you are producing a single variable font containing an entire family, this approach will save you an external file.
- Write the file as above, point 1.
- Insert it into the Designspace file's lib under the
org.statmake.stylespacekey. See tests/data/TestInlineStylespace.designspace for an example. - Proceed from point 3 above.
Q: Can I please have something other than a .plist file?
Yes, but you have to convert it to .plist yourself, as statmake currently only read .plist files. One possible converter is Adam Twardoch's yaplon.
Q: I'm getting errors about how statmake doesn't like the way I wrote the Stylespace, but I want the data to be that way?
Use a custom script with the https://fonttools.readthedocs.io/en/latest/otlLib/builder.html#fontTools.otlLib.builder.buildStatTable API instead.
Development setup
The project uses uv; install it from https://docs.astral.sh/uv/, and then:
# Install this project and its dependencies
uv sync
# Install tox globally for your user with uv support (if your other projects use it too)
uv tool install tox --with tox-uv
# Run tests on various Python versions
tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file statmake-2.0.1.tar.gz.
File metadata
- Download URL: statmake-2.0.1.tar.gz
- Upload date:
- Size: 55.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21704ec64107c797d6cc6cd74deb5c8a60061054fdc9eaa1274211e83c78db3d
|
|
| MD5 |
354fceef4691a497171b0cf3f5a2e626
|
|
| BLAKE2b-256 |
586a45b7f8cf6edb81773f81544bd32ac07bba47cb8e178db57691b1cddb0230
|
File details
Details for the file statmake-2.0.1-py3-none-any.whl.
File metadata
- Download URL: statmake-2.0.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2db8898d44976292f989e0c96c35f1d355b131ac535051a825fafe73ac81f5
|
|
| MD5 |
9d2f416180b7f9a628b275d9ca95caf0
|
|
| BLAKE2b-256 |
e105ccbe8d341edac15873e64829efe7c6fb2462299db096d58a01a2dfa4b5c4
|