Skip to content

fix(kernel-text): vendor builtin font instead of reading node_modules - #826

Merged
ecto merged 1 commit into
mainfrom
claude/determined-maxwell-679016
Aug 21, 2026
Merged

fix(kernel-text): vendor builtin font instead of reading node_modules#826
ecto merged 1 commit into
mainfrom
claude/determined-maxwell-679016

Conversation

@ecto

@ecto ecto commented Aug 20, 2026

Copy link
Copy Markdown
Owner

What

crates/vcad-kernel-text embedded its font with

include_bytes!("../../../node_modules/next/dist/compiled/@vercel/og/noto-sans-v27-latin-regular.ttf")

so a Rust build depended on a JS install having happened first. cargo build --workspace fails on a fresh clone, a fresh git worktree, and currently on the main checkout (no node_modules).

  • Vendored the font as crates/vcad-kernel-text/assets/NotoSans-Regular.ttf (27 KB, byte-identical to the copy next shipped) and pointed include_bytes! at it.
  • Added assets/LICENSE-NotoSans.txt — the font's name table declares http://scripts.sil.org/OFL with Google's 2015–2021 copyright, so it's OFL 1.1 and redistribution is fine with the license text alongside.
  • Fixed the docs: the bytes are Noto Sans Regular v2.007, not Open Sans (the static is still named OPEN_SANS_REGULAR for compatibility).
  • no-builtin-font stays, but is now just a size knob (~27 KB), not a node_modules workaround. Dropped the --features …/no-builtin-font flags 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 in vcad-kernel-wasm/Cargo.toml and vcad-ffi/Cargo.toml updated; vcad-ffi keeps 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

`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>
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated (UTC)
mecheval Ignored Ignored Aug 20, 2026 10:15pm
vcad Ignored Ignored Aug 20, 2026 10:15pm
vcad-docs Ignored Ignored Aug 20, 2026 10:15pm
vcad-mcp Ignored Ignored Aug 20, 2026 10:15pm

Request Review

@chojiai

chojiai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Choji review — Looks good — no findings

Choji review — Looks good · reviewed 8c1c8eb · static · details →

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


Rate findings

Choji updates this comment as you push · Mention @chojiai in a comment to discuss, re-review, or request a fix

@ecto
ecto merged commit b412652 into main Aug 21, 2026
15 checks passed
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