Embed handwriting fonts in the exported PDF#50
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23.
The PDF used Helvetica while the preview showed handwriting — so the export never matched the screen. Now the selected caption font is embedded in the PDF, making it WYSIWYG.
How
src/fonts/, imported as?urlassets and fetched lazily at export time (cached), then embedded subsetted via@pdf-lib/fontkit.ttfto the PWA precache so export stays fully offline.Why Caveat was dropped
The blocker on #23 was never variable-vs-static — I rendered a static Caveat instance and it still came out "Cort ona". Caveat is a semi-connected script that relies on GPOS kerning, which pdf-lib doesn't apply, so letters drift apart. Rather than ship a font that can't print faithfully, I replaced Caveat with Indie Flower — a casual handwriting font that's unconnected and renders pixel-perfect. The set is now Indie Flower (default) · Patrick Hand · Shadows Into Light · Kalam, all WYSIWYG.
Verification
Rendered a sample PDF per font (pdf-lib + fontkit) and rasterized to PNG to eyeball spacing: Indie Flower, Patrick Hand, Shadows Into Light and Kalam all render "Cortona / October 2008 / Nikon D7000 35mm" correctly (Caveat was the only one that broke). Embedding works with
subset: true. typecheck / oxlint / build green; all 4 TTFs land in the SW precache.If you'd rather keep Caveat on screen, I can add it back as a screen-only font, or implement manual GPOS kerning for it in the PDF — say the word.