embedded-typst
A typst::World for embedding the Typst
compiler in an application, without the typst CLI.
Fonts: Typst's bundled fonts, in-memory fonts (include_bytes!), system fonts and font directories. Fonts on disk are only read when a document uses them. Build once and share between compilations with anArc.EmbeddedWorld: the main source, in-memory files, root directories searched in order,sys.inputs, a fixed creation timestamp for reproducibledatetime.today()and, with thepackagesfeature,@preview/…and@local/…imports from the typst CLI's package directories.dependencies()lists every file read from disk.- Wasm: builds for
wasm32-unknown-unknown; there, only fonts and files given as data are available.
use Arc;
use ;
use VirtualPath;
let fonts = new;
let world = new
.with_roots
.with_creation_timestamp;
let document = .output?;
Features
| Feature | Default | Adds |
|---|---|---|
typst-fonts |
yes | FontsBuilder::typst_fonts: Libertinus, New Computer Modern, DejaVu Sans Mono |
packages |
no | Packages and EmbeddedWorld::with_packages (native only) |
download |
no | Packages::download: fetch missing @preview packages from Typst Universe |
Used by typstgen and renderreport.
License
MIT