Skip to content

feat: make typst fonts more hermetic - #13

Merged
matte1 merged 8 commits into
mainfrom
matte1/hermetic-fonts
Sep 2, 2026
Merged

matte1 merged 8 commits into
mainfrom
matte1/hermetic-fonts

Conversation

@matte1

@matte1 matte1 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

matte1 added 8 commits August 27, 2026 22:17
GitHub only exposes asset digests for recent releases, so every run
re-downloaded 1.5 GB of archives to hash releases that were already
recorded. Read the integrity values back out of versions.bzl first and
fall back to downloading only for assets that have neither.

Sort the generated mapping so a new release shows up as an addition
rather than reordering the whole file.
write_source_file runs plain diff when its test fails, which dumps xref
offsets and compressed font streams into the log; a ten page document
produces several hundred lines of noise. Pass --brief so the failure
reports the file and the command that regenerates it.
Typst searches the host font directories, so a document that renders
with a system font embeds whichever build of that font the machine
happens to have. Two machines with the same Typst version and the same
sources then produce different PDFs, which shows up as an unexplained
diff test failure against a checked-in copy.

Those directories are not declared inputs, so the action was neither
reproducible nor correctly invalidated, and a remote cache hit could
carry one machine's fonts to another.

Pass --ignore-system-fonts so only the fonts embedded in the pinned
compiler are available. The checked-in example PDF is regenerated: its
monospace text was picking up a host copy of DejaVu Sans Mono.
A `@preview` import resolves against a system-dependent package
directory and download cache, so a document could compile against
whatever a developer happened to have in ~/.cache/typst and fail
elsewhere. Same failure mode as host fonts.

Point --package-path and --package-cache-path at a directory created
for the action, alongside the runfiles tree and outside the document
root.
The wrapper printed the compiler's stdout and discarded its stderr
unless the compile failed. Typst reports an unknown font family as a
warning and falls back to a default, so a document could render with
the wrong font and leave a clean build log.
Typst defaults to a thread per CPU, which oversubscribes the machine
when Bazel schedules several document actions at once. Bazel budgets one
CPU per action, so let it own the parallelism. Output is unaffected.
Adds the 0.15.0 and 0.15.1 releases to the version matrix and moves the
default to 0.15.1. Existing entries are unchanged.

The checked-in example PDF is regenerated: a compiler change moves the
output bytes.
Host fonts are no longer searched, so documents that relied on a system
font now render with an embedded fallback and every checked-in PDF needs
regenerating.
@matte1
matte1 force-pushed the matte1/hermetic-fonts branch from 5a70bd8 to 8aeea91 Compare September 1, 2026 20:49
@matte1 matte1 changed the title Matte1/hermetic fonts feat: make typst fonts more hermetic Sep 2, 2026
@matte1
matte1 merged commit 544f65f into main Sep 2, 2026
9 checks passed
@matte1
matte1 deleted the matte1/hermetic-fonts branch September 2, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant