Skip to main content

sr-aef

crates.io docs.rs

sr-aef "uncompiles" an OpenType/TrueType font back into Adobe Feature File (fea) source code. It reads the OpenType layout tables (GSUB, GPOS and, optionally, GDEF) out of a compiled binary font and reconstructs an equivalent feature file using the fea-rs-ast AST.

Because binary fonts lose the original structure of their layout code (lookup splitting, class naming, comments, ...), the output is a faithful functional reconstruction rather than a byte-for-byte copy of the original source.

sr-aef is used by babelfont when compiling a font back to TrueType, and can also be used directly as a "TTF to fea" tool.

Library usage

The main entry points are uncompile, uncompile_bytes, and uncompile_context.

use sr_aef::{fea_rs_ast::AsFea, uncompile_bytes};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let data = std::fs::read("MyFont.ttf")?;
    let feature_file = uncompile_bytes(&data, true)?; // `true` also uncompiles GDEF
    println!("{}", feature_file.as_fea(""));
    Ok(())
}

The returned value is a fea_rs_ast::FeatureFile; call .as_fea() (via the AsFea trait) to render it as feature file text.

For tools that want the component parts rather than a finished feature file, uncompile_context returns an UncompileContext with the reconstructed lookups, classes, mark classes, anchors and language systems, ready to be placed wherever you need them.

Version pinning

sr-aef re-exports the exact versions of fea-rs-ast and skrifa that it is built against (sr_aef::fea_rs_ast and sr_aef::skrifa). If you are already using those crates, prefer the re-exports so that the AST and font-reading types line up with what sr-aef produces.

Command-line usage

A small CLI is available behind the cli feature:

cargo install sr-aef --features cli

or from PyPI:

pip install sr-aef

Print the reconstructed feature file for a font:

sr-aef MyFont.ttf

Dump the intermediate, partially-uncompiled context as JSON (useful for debugging):

sr-aef --debug MyFont.ttf

Status

sr-aef is in early development and its API may change between releases.

License

sr-aef is available under the MIT or Apache-2.0 licenses, at your option. See LICENSE-MIT and LICENSE-APACHE.

Metadata

Release files for sr-aef 0.1.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 sr-aef 0.1.1
File Size Uploaded Provenance Actions
sr_aef-0.1.1.tar.gz 930.5 kB Without provenance Details for sr_aef-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for sr-aef 0.1.1
File Actions
sr_aef-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for sr_aef-0.1.1-py3-none-win_amd64.whl
sr_aef-0.1.1-py3-none-win32.whl Python 3 none Windows x86-32 Details for sr_aef-0.1.1-py3-none-win32.whl
sr_aef-0.1.1-py3-none-musllinux_1_1_x86_64.whl Python 3 none Linux musl 1.1+ x86-64 Details for sr_aef-0.1.1-py3-none-musllinux_1_1_x86_64.whl
sr_aef-0.1.1-py3-none-musllinux_1_1_aarch64.whl Python 3 none Linux musl 1.1+ ARM64 Details for sr_aef-0.1.1-py3-none-musllinux_1_1_aarch64.whl
sr_aef-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for sr_aef-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
sr_aef-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for sr_aef-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
sr_aef-0.1.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl Python 3 none macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details for sr_aef-0.1.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 10.0 MB

Release files / sr_aef-0.1.1.tar.gz

Download URL sr_aef-0.1.1.tar.gz
Size 930.5 kB
Tags Source
SHA-256 checksum
How to use checksums
39ce82346e22c0b62b5246e405fa60bcb948c9bbe0e383d73fee33e270aa0146
BLAKE2b-256 checksum
How to use checksums
891d149aa1cf968b9908cf1bcc6dfbe321bb5d46191ae93afff9ded170c3b877
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-win_amd64.whl

Download URL sr_aef-0.1.1-py3-none-win_amd64.whl
Size 983.8 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6cef7f8d97047b2b95d31519edfe636868ea1a28d1c448d3d83c32dc78676c3e
BLAKE2b-256 checksum
How to use checksums
e94653a1216f047e14e6e01f6e9ef8baacd31844f7883bf4bc629e9fef4018b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-win32.whl

Download URL sr_aef-0.1.1-py3-none-win32.whl
Size 914.8 kB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
312456725e0299e3170e606d22b9222ce67509e67189419b9f8f023368470622
BLAKE2b-256 checksum
How to use checksums
1233b9a748a968ec6a2bd9ba16b21bb36d11037c4d63e9a86bf96cbf8c085a6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-musllinux_1_1_x86_64.whl

Download URL sr_aef-0.1.1-py3-none-musllinux_1_1_x86_64.whl
Size 1.3 MB
Tags Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
af865638161f71c7ea1ad0438c3ec517d10381381a4e3aac9dc43d3ebd5e2154
BLAKE2b-256 checksum
How to use checksums
ad88b0578376849996a21438751a4c54f1bf422d8c550557f8095c230560ac54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-musllinux_1_1_aarch64.whl

Download URL sr_aef-0.1.1-py3-none-musllinux_1_1_aarch64.whl
Size 1.2 MB
Tags Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0dd4ddfbc8fe8f819c18854d1a4e31f6b37e59cefaa8fe8e54732e13f8f5920b
BLAKE2b-256 checksum
How to use checksums
a6e938c1cdc9c0dcbdae5f2db70fa80c1d53fc9135810e9a0e211497cad83312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL sr_aef-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4f465d249717d4fc3cc31cbe23fb41cf006570cfdd5467709022958c0bdb2193
BLAKE2b-256 checksum
How to use checksums
f3078a312484313f6d3de0b687d967493f53c1f139094dd41d4a5fd4dd5c3252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL sr_aef-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.2 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ac3a99e50d2b33edd99299f6f2191dd9f86fd2de67513a0ddadc9fe3a180ec82
BLAKE2b-256 checksum
How to use checksums
66af191e8d2b4527170215886153548bebd2279cc25ccf6ee192763e5d634dd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / sr_aef-0.1.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL sr_aef-0.1.1-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 2.2 MB
Tags Python 3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b7d9228e4b7747ce75b98bfbbcfac79e9c55d16d35bf2bda80e7ca5a83e8f2bb
BLAKE2b-256 checksum
How to use checksums
1df795a176888f6727babf7230a39c204e90a6afa192a76ae5c9d4a54757f4a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for sr-aef 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

8 release files No provenance

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