fix(kernel-text): vendor builtin font instead of reading node_modules - #826
Merged
Conversation
`vcad-kernel-text` embedded its font via
include_bytes!("../../../node_modules/next/.../noto-sans-v27-latin-regular.ttf"),
so `cargo build --workspace` failed on any checkout without a JS install —
fresh clones, fresh worktrees, and Rust-only CI jobs.
Vendor the font into the crate (assets/NotoSans-Regular.ttf, byte-identical
to the copy `next` shipped) with its OFL 1.1 license text alongside
(assets/LICENSE-NotoSans.txt); the font's name table declares
scripts.sil.org/OFL, so redistribution is fine with the license included.
Docs also corrected: the bytes are Noto Sans, not Open Sans.
`no-builtin-font` stays as a size knob, but the CI flags that existed only to
work around the missing file are dropped, so clippy/test/build/doc and the
wasm-pack build now compile the font path (the wasm build matches the shipping
bundle again).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Choji review — Looks good · reviewed Clean, correct fix — the font is now vendored in the crate's own assets directory, the include_bytes! path is valid at compile time without any JS toolchain, and all CI/workflow references to the old node_modules workaround are consistently updated. No correctness, security, or logic issues found. CI is green on this head. No findings · review page Choji updates this comment as you push · Mention @chojiai in a comment to discuss, re-review, or request a fix |
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.
What
crates/vcad-kernel-textembedded its font withso a Rust build depended on a JS install having happened first.
cargo build --workspacefails on a fresh clone, a fresh git worktree, and currently on the main checkout (nonode_modules).crates/vcad-kernel-text/assets/NotoSans-Regular.ttf(27 KB, byte-identical to the copynextshipped) and pointedinclude_bytes!at it.assets/LICENSE-NotoSans.txt— the font'snametable declareshttp://scripts.sil.org/OFLwith Google's 2015–2021 copyright, so it's OFL 1.1 and redistribution is fine with the license text alongside.OPEN_SANS_REGULARfor compatibility).no-builtin-fontstays, but is now just a size knob (~27 KB), not a node_modules workaround. Dropped the--features …/no-builtin-fontflags whose only reason was the missing file:ci.yml(clippy/test/build/doc and the wasm-pack build),fix-ci.yml,torture-track.yml. Stale comments invcad-kernel-wasm/Cargo.tomlandvcad-ffi/Cargo.tomlupdated;vcad-ffikeeps the feature on by default since a native app doesn't render with it.Verification
Run in a worktree with no
node_modules:cargo build -p vcad-kernel-text✅cargo test -p vcad-kernel-text✅ (10 passed)cargo clippy -p vcad-kernel-text -- -D warnings✅cargo build -p vcad-kernel-text --features no-builtin-font✅cargo fmt -p vcad-kernel-text --check✅,cargo check -p vcad-kernel✅Reviewer note
CI's Rust jobs and the wasm-pack build now compile the font embed they previously skipped — that's the intent (the shipping wasm always kept the font, so CI was building a different shape), but it does mean those jobs exercise the real
Font::default()glyph path for the first time. The text tests pass locally under it.🤖 Generated with Claude Code