pdfcraft/crates/fonts
Brandon Thomas d3db99818f
Rename PrintCraft to PdfCraft (#174)
The app, crates, binaries, bundle id, packaging, icons, screenshots and docs are now
PdfCraft / pdfcraft (repo storytold/pdfcraft). On first launch the desktop app moves the
PrintCraft settings and crash-recovery folders to the new name, and both apps read settings
saved under the old storage key, so upgrades keep recent files, preferences and unsaved work.
The signing test fixtures keep their PrintCraft subject names (they are binary).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:03:57 -04:00
..
src Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
Cargo.toml Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
README.md Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
build.rs Fonts: use craft-fonts as an optional build input; move the Japanese fonts out 2026-10-06 11:36:23 -04:00

README.md

pdfcraft-fonts

Layer L2. Font helpers for the appearance streams PdfCraft generates (comments, form fields).

Today it holds what generated appearances need without a font program:

  • helvetica_width: an approximation of Helvetica's proportions by character class. No metrics file or font program from any vendor is bundled; widths are PdfCraft's own estimates, good enough for line breaking and alignment, not for typesetting.
  • wrap: greedy line breaking with that measure (paragraphs on newlines, long words split).
  • win_ansi: Unicode → WinAnsiEncoding bytes (? for characters it can't represent), and literal to write bytes as a PDF literal string.

It also holds the fonts of the optional craft-fonts build input. build.rs embeds them as CRAFT_FONTS when the build sets CRAFT_FONTS_DIR=<checkout> (and fails if it can't while CRAFT_FONTS_REQUIRED=1, as releases set). Without that variable CRAFT_FONTS is empty and everything below copes:

  • ui_japanese_fonts: the Jpan faces for the interface, BIZ UDPGothic first.
  • document_japanese_font / japanese_glyph: the face (Shippori Mincho, then BIZ UDMincho) whose outlines become the Type 3 fallback font for Japanese text written into PDFs. Without it, japanese_glyph returns GlyphError::NoFont and the editor reports a clear error.
  • SHIPPORI_MINCHO: Shippori Mincho's bytes, or None.

wasm32 builds embed only BIZ UDPGothic Regular, to keep the web build small. Font files are never committed here (AGENTS.md §1.4; team members: craftrules standards/fonts.md, internal).

The full font subsystem (parsing, shaping, subsetting and embedding) arrives with M2.2/M7.