sr-aef
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 ;
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:
or from PyPI:
Print the reconstructed feature file for a font:
Dump the intermediate, partially-uncompiled context as JSON (useful for debugging):
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.