| Crates.io | typwriter |
| lib.rs | typwriter |
| version | 0.14.26 |
| created_at | 2026-01-10 16:14:38.913487+00 |
| updated_at | 2026-01-18 06:37:51.704888+00 |
| description | A Rust library for compiling, formatting, and watching Typst documents, with PDF metadata and permission management. |
| homepage | https://github.com/0x6b/typwriter |
| repository | https://github.com/0x6b/typwriter |
| max_upload_size | |
| id | 2034395 |
| size | 4,708,864 |
A Rust library for compiling, formatting, and watching Typst documents, with PDF metadata and permission management.
typwriter = { version = "0.14", features = ["full"] }
or
cargo add typwriter --fatures full
The crate may function in other environments, but it has only been tested in the following environment:
Version 0.14.2 (December 3, 2025)
This crate is for my personal use and learning purposes; it is not affiliated with the Typst project.
fullSpecify full to enable all the following features.
compileYou can compile a Typst document to a PDF or a PNG file; a limited subset of typst-cli.
See examples/compile.rs for usage.
$ cargo run --example compile --features embed_additional_fonts
formatYou can format a Typst document with typstyle.
See examples/format.rs for usage.
$ cargo run --example format --features format
pdf_metadataYou can update PDF metadata. Following metadata is supported:
| Metadata | In Acrobat Reader | In Apple Preview |
|---|---|---|
| Title | Title | Title |
| Author | Author | Author |
| Application | Application and PDF Producer | PDF Producer and Content creator |
| Subject | Subject and Description | Subject |
| Copyright status | Copyright Status | (None) |
| Copyright notice | Copyright Notice | Yes |
| Keywords | Keywords | Keywords |
| Creation date | Created | Creation date |
| Modification date | Modified | Modification date |
| Custom properties | Custom Properties | (None) |
[!Note]
- All metadata will be overwritten, not merged.
- Both creation and modification date are set automatically to the current date without time information which means time is always 0:00 UTC, for some privacy reasons (or my preference.)
You can specify some of them with Typst. As of Typst v0.14.2, the following metadata is supported:
See Document Function – Typst Documentation for details.
See examples/update_metadata.rs for usage.
$ cargo run --example update_metadata --features pdf_metadata
pdf_permissionYou can set the following PDF 1.7 permissions:
None to allow anyone to open.None to allow anyone to change.The only supported encryption algorithm is AES-256.
See examples/set_permission.rs for usage.
$ cargo run --example set_permission --features pdf_permission
watchYou'll be able to preview your Typst document live. Changes for typ file, along with files with extension cbor, csv, gif, htm, html, jpeg, jpg, json, png, svg, toml, txt, xml, yaml, and yml in the same directory, recursively, will be watched. This is inspired by ItsEthra/typst-live.
See examples/watch.rs for usage.
$ cargo run --example watch --features watch
This feature also enables compile feature.
You can embed additional fonts in the binary for easier deployment. Each feature also enables compile feature.
embed_additional_fonts: embed all fonts listed below.embed_cmu_roman: Computer Modern Romanembed_ia_writer_duo: iA Writer Duoembed_noto_emoji: Noto Emojiembed_noto_sans_jp: Noto Sans JPembed_noto_serif_jp: Noto Serif JPembed_recursive: Recursive Sans & Monoembed_source_code_pro: Source Code Proembed_warpnine_mono: WarpNine Monoembed_warpnine_sans: WarpNine Sans[!Note] typst-cli defaults are always embedded.
[!Note] The following font features require network access at build time to download fonts:
embed_noto_sans_jpembed_noto_serif_jpembed_recursiveembed_warpnine_monoembed_warpnine_sansDownloaded fonts are cached in
$XDG_CACHE_HOME/typwriter/fonts(or~/.cache/typwriter/fontson macOS/Linux).
[!Warning]
- The crate won't search system fonts to ensure the reproducibility. All fonts you need should be explicitly added via
CompileParams.font_paths.- Embedding fonts will produce a large binary.
Naive tests are available. You can run them with:
$ cargo test --all-features
Note that you have to install exiftool to run all tests.
assets/fonts directory are licensed under its own license. See the assets/fonts/README.md for details.