text-1c: declare fonts with --font, and render text - #72
Conversation
Text was compilable but unreachable from the product surface: the CLI
had no way to declare a font, so every <text> run refused. It now does,
under the hermetic rule the text-oracle method ratified.
--font FAMILY=PATH@sha256:HEX (repeatable)
A family name is not a font identity — the same name resolves to
different bytes on different machines — so a declaration carries the
digest of the bytes it means, and the host verifies them before a frame
exists. A mismatch refuses the render; it never becomes a silently
different pixel. An undeclared family refuses by name: no system
fallback, no ambient face, no machine-local pixel anywhere on this path.
The end-to-end law renders fixtures/web-first/text/svg-text-em-box.svg
through the host and asserts it is the committed Chromium oracle byte
for byte — the same cell the compiler gate uses, now proven through the
product surface it ships behind.
The statement of record gains the text slice: the environment rule, the
v0 profile, what places a run, the numeric domain and why it is where
the gate holds, and every named refusal (including the CSS spelling of
text-anchor, a generic family, and the inline-HTML entry, which declares
no fonts).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
WalkthroughThe CLI now accepts repeatable SHA-256-pinned font declarations. It verifies font bytes, builds a ChangesHermetic font rendering
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant parse_render_options
participant load_environment
participant textlayout_Environment
participant render_source_to_png
CLI->>parse_render_options: Parse --font declarations
parse_render_options-->>CLI: Return FontDeclaration values
CLI->>load_environment: Verify declared font bytes
load_environment->>textlayout_Environment: Create verified environment
textlayout_Environment-->>CLI: Return font environment
CLI->>render_source_to_png: Render with font environment
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Text was compilable but unreachable from the product surface. #71 admitted
<text>, but the CLI had no way to declare a font, so every run refused — the feature shipped behind a door with no handle. This adds the handle, under the hermetic rule the method ratified in #68.The digest is executable
A family name is not a font identity — the same name resolves to different bytes on different machines — so a declaration carries the digest of the bytes it means, and the host verifies before a frame exists. Three behaviors, all exercised against the real binary:
degraded: skipped svg/text[1]: … font family "Ahem" is not in the declared environmenterror: … is not the declared identity: expected sha256 0000…, read b719ecb3…— refuses before any pixelNo system fallback, no ambient face, no machine-local pixel anywhere on this path.
The end-to-end law
declared_fonts_render_text_and_an_undeclared_one_refusesrenders the text cell through the host and asserts it equalsfixtures/web-first/text/chromium/svg-text-em-box.pngbyte for byte — the same cell the compiler gate uses, now proven through the surface it actually ships behind. The parse and verification laws cover the grammar's edges: a path containing=and@still parses (only the first=ends the family, only the last@sha256:ends the path), a missing or malformed digest refuses with the reason, and the pinned gate font verifies while a wrong digest does not.Statement of record
crates/n0_cli/README.mdgains the text slice — the environment rule, the v0 profile, what places a run, the numeric domain and why it is where the gate holds, and every named refusal (the CSS spelling oftext-anchor, a generic family,<tspan>, stroke on text, colour faces, the inline-HTML entry which declares no fonts). That file is the one statement of record for the admitted slice, so this closes the gap #71 left in it.Full workspace green, fmt and clippy clean, lock unchanged (
sha2was already in the graph).With this, text is complete end to end and the arc's remaining item is text-2 — the D-M deciding spike.