rassa
rassa is a Rust rewrite of the ASS subtitle rendering stack. The project is split into small Rust crates for parsing, font lookup, shaping, rasterization, layout, rendering, and C ABI packaging.
The preferred integration target for new applications is the rassa-branded shared library, librassa.so, built from the rassa crate. A separate compatibility package can still build libass.so for applications that specifically need a libass-shaped linker target.
Status: experimental.
librassa.sois the forward-looking ABI target and may evolve with rassa.libass.sois provided as a compatibility target, but this project does not promise to track every upstream libass behavior forever.
Repository layout
crates/rassa-core— shared public Rust data types.crates/rassa-parse— ASS/SSA parser and style/event model.crates/rassa-fonts— font provider integration.crates/rassa-shape— text shaping.crates/rassa-raster— Rust glyph rasterization helpers.crates/rassa-layout— subtitle event layout.crates/rassa-render— image-plane renderer.crates/rassa— Rust API crate and native shared-library target, producinglibrassa.so.crates/rassa-capi— C ABI implementation exported from Rust.crates/rassa-libass-capi— libass-compatible shared-library target namedass, producinglibass.so.crates/rassa-check— command-line checker/debug utility.crates/rassa-test— compatibility and pixel-diff tests.include/ass— current public C headers.pkgconfig/rassa.pc— pkg-config metadata for the native rassa shared library.pkgconfig/libass.pc— pkg-config metadata for the libass-compatible target.
Requirements
- Rust 1.85 or newer.
- A Unix-like development environment for the current C ABI packaging flow.
- A C compiler if you want to compile C smoke tests or downstream C/C++ applications.
Build
Build all Rust crates:
Build the release rassa shared object for new applications:
The native shared library is produced by Cargo as:
# Linux
target/release/librassa.so
# Windows GNU target
target/x86_64-pc-windows-gnu/release/rassa.dll
# Web/wasm target
target/wasm32-unknown-unknown/release/rassa.wasm
Build the release libass-compatible shared object only when an application expects libass.so or -lass:
The compatibility shared library is produced by Cargo as:
# Linux
target/release/libass.so
# Windows GNU target
target/x86_64-pc-windows-gnu/release/ass.dll
# Web/wasm target
target/wasm32-unknown-unknown/release/ass.wasm
The compatibility crate sets the ELF SONAME to libass.so only on ELF targets, so Windows DLL, Darwin dylib/check, and WebAssembly builds do not receive ELF-only linker flags.
Build the checker utility and C ABI crates used during development:
Native C ABI usage (librassa.so)
Use this path for new applications that want to depend on rassa without making a strict libass compatibility promise:
- Header include path:
include/ - Current public headers:
include/ass/ass.handinclude/ass/ass_types.h - Library name:
librassa.so - Linker flag:
-lrassa - pkg-config file:
pkgconfig/rassa.pc
For local development from the repository root:
Compile a C file against the rassa shared object:
Or without pkg-config:
The current native C ABI reuses the same public entry points as the compatibility layer. New applications should link to librassa.so / -lrassa so their dependency is on rassa itself, not on the libass.so drop-in package name.
Compatibility C ABI usage (libass.so)
Use this path only for applications or plugins that already expect a libass-shaped package:
- Header include path:
include/ - Public headers:
include/ass/ass.handinclude/ass/ass_types.h - Library name:
libass.so - Linker flag:
-lass - pkg-config file:
pkgconfig/libass.pc
For local development from the repository root:
Compile a C file against rassa's libass-compatible ABI:
Or without pkg-config:
Minimal C smoke test:
int
Build and run it from the repository root:
Drop-in linking notes
For consumers that currently link against libass:
- Build
rassa-libass-capiin release mode. - Put
target/release/libass.soin the runtime library search path used by your application. - Put
include/in the C/C++ compiler include path. - Put
pkgconfig/inPKG_CONFIG_PATHif your build usespkg-config --libs libass. - Rebuild your downstream application and run its subtitle-rendering tests.
Example:
Then build the downstream project as usual. If it uses pkg-config, it should see:
Expected output shape:
-I.../include -L.../target/release -lass
Rust API usage
Use the rassa crate for native Rust applications. The public facade exports the parser, renderer, font provider traits, core geometry/color types, and a small safe Script/Renderer API.
Add the crate from crates.io:
[]
= "0.1.0"
Or, inside this repository, use a path dependency while developing:
[]
= { = "crates/rassa" }
Minimal render example:
use ;
If you need control over font lookup or frame sizing, build a provider/config explicitly:
use ;
The Rust API is not the same as either shared-library package. Use the rassa crate directly for native Rust integration, librassa.so for new C/C++ integrations, and rassa-libass-capi only when you need the libass.so package name.
Published crates and docs
The first published version is 0.1.0.
| Crate | Purpose | Docs |
|---|---|---|
rassa |
Safe Rust facade and native librassa.so target |
https://docs.rs/rassa |
rassa-core |
Shared data types and ASS enums | https://docs.rs/rassa-core |
rassa-parse |
ASS/SSA parser | https://docs.rs/rassa-parse |
rassa-fonts |
Cross-platform font provider traits and discovery | https://docs.rs/rassa-fonts |
rassa-unibreak |
Pure-Rust Unicode line and word breaking | https://docs.rs/rassa-unibreak |
rassa-unicode |
Pure-Rust Unicode bidi and segmentation helpers | https://docs.rs/rassa-unicode |
rassa-shape |
Text shaping | https://docs.rs/rassa-shape |
rassa-raster |
Glyph rasterization helpers | https://docs.rs/rassa-raster |
rassa-layout |
Subtitle event layout | https://docs.rs/rassa-layout |
rassa-render |
Image-plane renderer | https://docs.rs/rassa-render |
rassa-capi |
Shared C ABI implementation | https://docs.rs/rassa-capi |
rassa-libass-capi |
libass.so compatibility target |
https://docs.rs/rassa-libass-capi |
rassa-check |
CLI/library smoke checker and PNG/JPEG/PGM renderer | https://docs.rs/rassa-check |
Generate local docs for the whole workspace:
Generate docs for only the public facade:
Checker CLI usage
Install the checker from crates.io:
Render the built-in smoke script to PNG:
Render your own ASS/SSA file:
Supported output formats are inferred from the file extension: .png, .jpg/.jpeg, or .pgm. You can also set them explicitly with --format png|jpg|pgm.
Verification commands
Common local checks:
Broad corpus pixel-diff report (runs all generated upstream frames and logs mismatches without treating known parity gaps as a master-branch failure):
Opt-in strict broad corpus gate for renderer-parity work where the references are expected to be pixel-perfect:
RASSA_STRICT_BROAD_PIXEL_DIFF=1 \
Dump actual/target compare PNGs for debugging:
RASSA_DUMP_COMPARE=/tmp/rassa-compare-dump \
Filter the broad corpus by fixture name:
RASSA_BROAD_FILTER=broad_box RASSA_STRICT_BROAD_PIXEL_DIFF=1 \
Open-source contribution guidelines
- Keep this project a Rust rewrite. Do not vendor, compile, or wrap upstream libass C source in production code.
- Upstream libass fixtures, public headers, and generated reference artifacts may be used as compatibility test oracles when their licensing allows it.
- Keep ABI compatibility and rendering parity separate when reporting status: a symbol may exist before its behavior is fully compatible.
- Add tests for compatibility fixes. Prefer small focused tests plus corpus coverage for renderer changes.
- Run formatting, tests, clippy, and the relevant pixel-diff gates before submitting changes.
License
This repository is licensed under the MIT License. See LICENSE for details.
Some public compatibility headers keep their original notices where applicable.