mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-28 14:19:22 -08:00
Embed craft-fonts by default via .cargo/config.toml [env] (#1655)
CRAFT_FONTS_DIR has to be passed on the command line, so a plain `cargo build --release` silently produces a CJK-blind binary: build.rs warns "no craft-fonts embedded: Chinese and Japanese text will render as empty boxes" and carries on. A build-time requirement that lives only in a warning is one that gets forgotten and comes back as a bug report about missing glyphs. relative = true resolves against the repo root rather than hardcoding an absolute path, on the assumption the warning already makes: that craft-fonts is cloned beside this repo. No force, so a CRAFT_FONTS_DIR already in the environment still wins for a one-off build against a different font set. If craft-fonts is absent, behaviour is unchanged — build.rs warns exactly as now. This mirrors deckcraft's own config, which already ships this block. Verified with the variable removed from the environment (env -u CRAFT_FONTS_DIR cargo build --release): the crate recompiled and the warning did not appear. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Fredrik Hallin <fredrik.hallin@guidelinegeo.com>
This commit is contained in:
2 files changed
+9
-2
No files matched your search
+8
-1
@@ -6,10 +6,17 @@ xtask = "run -p xtask --"
|
||||
[target.wasm32-unknown-unknown]
|
||||
rustflags = ["-C", "target-feature=+simd128"]
|
||||
|
||||
[env]
|
||||
# aws-lc (digital signatures and TLS, through aws-lc-rs) detects the CPU when `main` asks it to
|
||||
# (`pdfcraft_sign::init_crypto`), not in a static initializer before `main`. On x86 it reads
|
||||
# `OPENSSL_ia32cap` then, and aborts when that asks for a feature the processor lacks; each
|
||||
# executable first runs itself again without the variable (#2916, `pdfcraft_platform::crypto_env`),
|
||||
# which it can only do once `main` runs.
|
||||
[env]
|
||||
AWS_LC_SYS_CFLAGS = "-DBORINGSSL_NO_STATIC_INITIALIZER"
|
||||
|
||||
# The optional craft-fonts build input (the Japanese face and the other UI faces; see
|
||||
# crates/fonts/build.rs). A plain build embeds nothing and prints no warning, so a local build
|
||||
# embeds a craft-fonts checkout next to this repository when there is one. A `CRAFT_FONTS_DIR`
|
||||
# already in the environment wins (CI sets its own), and a missing checkout only gives the
|
||||
# "building without craft-fonts" warning.
|
||||
CRAFT_FONTS_DIR = { value = "../craft-fonts", relative = true }
|
||||
@@ -81,7 +81,7 @@ For the crates you changed: `cargo fmt --check`, `cargo clippy -p <crate> -- -D
|
||||
- The workspace sets `unsafe_code = "forbid"`; no module allows `unsafe`. `[lints] workspace = true` in every crate.
|
||||
- Hostile-input sweep: `crates/automation/tests/it/hostile_args.rs`. The last-resort `catch_unwind` guards are in `crates/engine/src/doc_state.rs` and `crates/ui-egui/src/frame_guard.rs`.
|
||||
- Attribution: `ATTRIBUTION.toml` is the source (one entry per asset, SHA-256 each); `ATTRIBUTION.md` is generated by `cargo xtask assets --write`. The ArtCraft logos in `docs/brand/` are trademark assets under `docs/brand/LICENSE-brand.txt`.
|
||||
- Translations come from storytold/craft-i18n at the commit in `craft-i18n.rev`; PdfCraft keeps no catalogs. Fonts come from storytold/craft-fonts through `CRAFT_FONTS_DIR` (optional build input; code using `pdfcraft_fonts::CRAFT_FONTS` must work when it is empty); the Latin UI fonts in `assets/fonts/` stay here. The system interface font is read at runtime through `OnDemandFonts` with `SystemCandidates` (never embedded or shipped).
|
||||
- Translations come from storytold/craft-i18n at the commit in `craft-i18n.rev`; PdfCraft keeps no catalogs. Fonts come from storytold/craft-fonts through `CRAFT_FONTS_DIR` (optional build input; `.cargo/config.toml` points it at `../craft-fonts`, and a `CRAFT_FONTS_DIR` in the environment wins; code using `pdfcraft_fonts::CRAFT_FONTS` must work when it is empty); the Latin UI fonts in `assets/fonts/` stay here. The system interface font is read at runtime through `OnDemandFonts` with `SystemCandidates` (never embedded or shipped).
|
||||
- Automation: every feature is a tool in `crates/automation` (`pdfcraft-cli run` and `pdfcraft-cli mcp` share the table; see `crates/automation/README.md`). MCP and the UI control channel are opt-in. The control channel runs only with `--control <PORT>`, binds to loopback and authenticates with a token (`--control-token`, or an owner-only file named by `--control-token-file`, which `craft_platform::owner_only` sets and checks); never enable it by default or log the token.
|
||||
- Page modules register `PagePart`s (`canvas/page_parts.rs`) and act through the tool host (`canvas/page_tools.rs`). Keys and clipboard events are commands and tool claims, and the framework blocks both while a modal is open.
|
||||
- Large binary test oracles live in storytold/photocraft-corpus, not here; `cargo xtask corpus` fetches the pdf.js corpus pinned by commit and SHA-256.
|
||||
|
||||
Reference in new issue
Block a user