Repository navigation
render-pipeline: font metric sweep for #710 (Latin Modern vs Computer Modern) - #740
Conversation
… vs Computer Modern) What changed: - New measurement-only binary crates/render-pipeline/src/bin/font-metric-sweep.rs that compares the shipped Latin Modern OTF metrics against local pdfTeX Computer Modern TFM metrics (cmr10/cmmi10/cmsy10/cmex10), reusing the existing FontSet/LoadedFace/TexMathMetrics and tfm::Tfm reader paths. It writes no layout or rendering code and changes no rendering behavior. - tools/font-metric-sweep/run.sh + README.md: shared-machine-safe wrapper (CARGO_TARGET_DIR/CARGO_BUILD_JOBS) to re-run the sweep. - docs/evidence/font-metric-sweep-710.md: the generated evidence report, plus an added "What EXCEEDS means here" paragraph clarifying that the 0.1 bp rule / 0.5 bp position thresholds are a screening cutoff reused from this codebase's oracle-test tolerances, not a claim that a given glyph draws a mis-sized rule or that any test currently fails. - docs/INDEX.md: links the new evidence doc. What was run: - CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-metricship CARGO_BUILD_JOBS=4 tools/font-metric-sweep/run.sh --output docs/evidence/font-metric-sweep-710.md -> "wrote docs/evidence/font-metric-sweep-710.md (251 compared, 42 unmeasured)" - Independent hand check against tftopl dumps of the local TFMs (not the tool's own output) for three rows: \ell (cmmi10 0x60, CM CHARWD 0.41667 -> 4.16670pt, no CHARIC), cmex10 0x7B private brace piece (CM CHARWD 0.450005 -> 4.50005pt), cmsy10 0x30 \prime (CM CHARWD 0.275 -> 2.75000pt) — all match the report's CM-side numbers exactly. - Re-running the sweep after the wording change reproduced byte-identical numeric output; only the new caveat paragraph and its dynamically computed counts (69 gate-watch rows; 62 rule-EXCEEDS/7 approaches; 27 position-EXCEEDS/2 approaches) were added. Next step: none; this is a standalone measurement artefact for #710. Follow-up issues, if the Commander wants them, are one-oracle-at-a-time fixes for the flagged rows (starting with \ell in \sqrt{\ell/\ell}), not part of this PR. Implementation-Agent: gpt-5.6-luna (Codex) via daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222
left a comment
There was a problem hiding this comment.
Independent verification — VERIFIED (one non-blocking finding)
Fetched refs/review/pr-740 = f6f04ae2, own worktree, CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-vr3-740, CARGO_BUILD_JOBS=4.
1. Re-run, and what "reproduces" actually means
I ran the binary directly rather than through tools/font-metric-sweep/run.sh, because that wrapper hard-codes CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-metricsweep and would have shared a target dir with other lanes:
$ cd crates/render-pipeline
$ CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-vr3-740 CARGO_BUILD_JOBS=4 \
cargo run --bin font-metric-sweep -- --output /tmp/.../sweep-rerun.md
wrote /tmp/.../sweep-rerun.md (251 compared, 42 unmeasured)
Same headline line: 251 compared, 42 unmeasured. Diffed against the committed artefact:
$ diff docs/evidence/font-metric-sweep-710.md sweep-rerun.md
20c20
< Font directory supplied to `FontSet`: `/Users/dqi26/flashtex-wt/metric-sweep/crates/render-pipeline/../../apps/mac/Fonts`.
---
> Font directory supplied to `FontSet`: `/Users/dqi26/flashtex-wt/vr3-740/crates/render-pipeline/../../apps/mac/Fonts`.
24,25c24,25
< | Latin Modern CMR path | `/Users/dqi26/flashtex-wt/metric-sweep/.../lmroman10-regular.otf` | `1aa18cfe...` | ... |
< | Latin Modern math | `/Users/dqi26/flashtex-wt/metric-sweep/.../latinmodern-math.otf` | `6075562b...` | ... |
---
> | Latin Modern CMR path | `/Users/dqi26/flashtex-wt/vr3-740/.../lmroman10-regular.otf` | `1aa18cfe...` | ... |
> | Latin Modern math | `/Users/dqi26/flashtex-wt/vr3-740/.../latinmodern-math.otf` | `6075562b...` | ... |
Three lines differ, and all three are the checkout path. Every measured number, every SHA-256, every gate verdict is identical. So the PR's wording — "reproduced the numeric content byte-for-byte" — is precise and correct; the file as a whole is not byte-identical across checkouts, which is the finding at the bottom.
2. Counts, re-derived from the artefact rather than read off the summary
$ python3 - (count '| cm…' rows per '## ' section)
69 ## Gate watch list
251 ## Complete measured table
$ awk 'NR>526' docs/evidence/font-metric-sweep-710.md | grep -c '^| ' # minus 2 header rows
44 → 42
$ (gate-watch columns, tallied)
position gate: EXCEEDS 27, approaches 2, below 40
rule gate: EXCEEDS 62, approaches 7
251 compared rows, 42 unmeasured entries each on its own row with a reason, 69 gate-watch rows, 27 / 2 position and 62 / 7 rule — every number in the PR body checks out against the file itself.
Headline values present as claimed: \ell (cmmi10 0x60) +0.09330 pt = +0.09365 bp, CMEX brace pieces cmex10 0x7B/0x7D at +15.52995 pt (+15.58819 bp).
3. Spot-check against tftopl, rows I picked (not the PR's three)
I deliberately chose a row the PR did not hand-check, cmsy10 0x38 (\forall), plus \ell as a cross-check of its own claim:
$ tftopl $(kpsewhich cmsy10.tfm) cmsy10.pl
(CHARACTER O 70
(CHARWD R 0.555557)
(CHARHT R 0.694445)
)
Report row 453: cmsy10 0x38 … 5.55557 → 6.66000 | +1.10443 … 6.94445 → 6.96000 … 0.00000 → 0.02000. CM advance 0.555557 × 10 pt = 5.55557 pt ✓, CM height 6.94445 ✓, no CHARDP → CM depth 0.00000 ✓, no CHARIC → CM italic 0.00000 ✓.
$ tftopl $(kpsewhich cmmi10.tfm) cmmi10.pl
(CHARACTER O 140
(CHARWD R 0.41667)
(CHARHT R 0.694445)
...
Report row 379: cmmi10 0x60 … 4.16670 → 4.17000 … 6.94445 → 7.05000 … italic 0.00000 → 0.09000. 0.41667 × 10 = 4.16670 pt ✓, height 6.94445 ✓, and the absent CHARIC is why the CM italic correction is 0.00000 — which is the whole of the +0.09330 pt effective delta that prompted #710. Confirmed from the TFM, independently of the tool.
4. It changes no rendering behaviour
$ git diff --stat $(git merge-base origin/main refs/review/pr-740) refs/review/pr-740
crates/render-pipeline/src/bin/font-metric-sweep.rs | 1135 ++++++++++++++
docs/INDEX.md | 3 +
docs/evidence/font-metric-sweep-710.md | 574 ++++++++
tools/font-metric-sweep/README.md | 16 +
tools/font-metric-sweep/run.sh | 10 +
5 files changed, 1738 insertions(+)
All additions. The only src/ path is the new src/bin/ target — no existing layout src/ file is touched, and no library code is reachable from a changed line. The "measurement-only" framing holds.
Finding (non-blocking)
docs/evidence/font-metric-sweep-710.md:20,24,25 embed an absolute, machine-local checkout path (/Users/dqi26/flashtex-wt/metric-sweep/...), a worktree that no longer exists. Consequences:
- The committed artefact cannot be reproduced byte-identically by anyone — including this lane — because those three lines encode where it was run, not what was measured. Anyone re-running it and diffing gets three spurious hunks and has to decide whether to trust them.
- It would also make the doc churn on every re-run from a different worktree, which is exactly the kind of noise that erodes an evidence file's value over time.
Cheap fix, if you take it: emit the path relative to the repository root (the binary already knows it, run.sh computes ROOT), keeping the SHA-256 columns as the actual provenance — they are what pin the faces, and they already match across my run and yours. Not worth blocking a measurement-only PR over.
— independently verified by daniel-parent's review lane
What changed:
The font-metric-sweep generator baked this machine's absolute checkout
path into docs/evidence/font-metric-sweep-710.md (via env!("CARGO_MANIFEST_DIR")
and FontSet's loaded-face paths), so the document referenced a worktree
that no longer exists and could not be byte-reproduced from any other
checkout. path_for_report and the font-directory line now go through a
new relative_to_repo() helper: paths inside the repo are rendered
repo-relative; paths outside it (the system TeX Live TFMs and
fontmath.ltx) keep the absolute form since there is no relative form for
them, and each row already carries a SHA-256 of the file's contents for
identity. Regenerated the doc with tools/font-metric-sweep/run.sh; only
the three flagged lines changed (font directory, LM CMR path, LM math
path), all 251/42 row counts identical.
What was run:
- cargo build --manifest-path crates/render-pipeline/Cargo.toml --bin font-metric-sweep (CARGO_BUILD_JOBS=4): clean build, only pre-existing unrelated warnings.
- cargo run ... --bin font-metric-sweep -- --output docs/evidence/font-metric-sweep-710.md: "wrote docs/evidence/font-metric-sweep-710.md (251 compared, 42 unmeasured)", matching the prior committed counts.
- Cross-checkout reproducibility: copied the fixed generator into a second worktree at a different absolute path (/Users/dqi26/flashtex-verify-metric-sweep-740) and regenerated there; `diff` reported no differences and both outputs hashed to the same SHA-256 (75e15dee6575eb60809838f156895777e1e71ef214d7e3b60114a082953f6b25).
Next step: none; verification round item closed.
Implementation-Agent: claude-sonnet-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Verification-round fix: Fixed in the generator (
Regenerated via Only the three flagged lines changed; every other line (all 251 measured Proof the document's own claim holds — ran the fixed generator from a Byte-identical, same SHA-256, from two different absolute checkout paths. Pushed as |
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
What
Measurement-only font metric sweep for #710. A new standalone binary,
crates/render-pipeline/src/bin/font-metric-sweep.rs, compares the shipped10pt Latin Modern OTF metrics (as loaded by this engine's own
FontSet/LoadedFace/TexMathMetrics::otf_glyphpath) against local pdfTeXComputer Modern TFM metrics (via the existing
render-pipeline::tfm::Tfmwrapper) for every glyph in the CMR/CMMI/CMSY/CMEX math families. It writes
docs/evidence/font-metric-sweep-710.md, and ships a shared-machine-safewrapper at
tools/font-metric-sweep/run.sh+ README so it can be re-run.No rendering or layout behavior changes. The diff is one new bin, one new
tools/directory, one new evidence doc, and a 3-linedocs/INDEX.mdlink.No existing
src/file besides the new binary was touched.Why
#710 was filed after
\ellwas found 0.09331pt wider in Latin Modern than inComputer Modern, putting
\sqrt{\frac{\ell}{\ell}}'s vinculum 0.0930bp off —inside the 0.1bp rule gate by only 0.007bp. Rather than discover the next such
case one oracle at a time, this sweep measures every CM-vs-LM glyph metric at
once and flags candidates against the same tolerances the render-pipeline
oracle tests already use.
Overlap check
gh pr list --repo flash-tex/flashtex --state all --search "710"and asearch for "font-metric-sweep" turned up no other PR touching this. Claim
GH-710-FONT-METRIC-SWEEPwas held by daniel-parent for this task; no otheractive claim overlaps
crates/render-pipeline/src/bin/font-metric-sweep.rsor
tools/font-metric-sweep/.Test results
cmsy10 82, cmex10 33.
char-box delta): 69 rows — 27 position-gate (0.5bp) EXCEEDS, 2
position approaches; 62 rule-gate (0.1bp) EXCEEDS, 7 rule
approaches. Near-gate names include
\xi,\ell,\zeta,T,V,\eta,y.cmex10 0x7B/0x7D,U+23DF/U+23DE) at +15.58819 bp (relative +3.45); these are
source-piece comparisons, not independent LM assembly glyphs.
\ell(cmmi10 0x60): raw advance CM 4.16670pt → LM 4.17000pt(+0.00330pt); italic correction CM 0.00000pt → LM 0.09000pt; effective
math char-box delta +0.09330pt = +0.09365bp — the number that
prompted fonts: Latin Modern \ell is 0.09331pt wider than cmmi10 — radical bar lands 0.0930bp off, just inside the 0.1bp gate #710.
Codex measured.
tftopldumps of the local TFMs(independent of the tool's own output):
\ell(cmmi10 O140octal = 0x60): TFMCHARWD R 0.41667(→4.16670ptat design size 10pt), no
CHARIC(→0.00000pt) — matches the report'sCM-side numbers exactly.
cmex10 0x7Bprivate brace piece (O173): TFMCHARWD R 0.450005(→4.50005pt),
CHARHT R 0.119998(→1.19998pt) — matches exactly.cmsy10 0x30\prime(O60): TFMCHARWD R 0.275(→2.75000pt),CHARHT R 0.555557(→5.55557pt) — matches exactly.reason in the "Unmeasured or out-of-scope rows" section (composite/overprint
constructs like
\hbar,\not; slots with no four-family CM declaration;engine slot-to-glyph mappings that return no glyph, e.g. two CMEX brace
positions and two CMEX arrow positions;
\varnothing's NCM-sentinel path).say what an
EXCEEDSmark means. Added a paragraph (generated by the toolitself, with live counts) making explicit that the 0.1bp/0.5bp thresholds
are the same generic oracle-test tolerances reused as a screening cutoff on
each glyph's raw metric delta in isolation — an
EXCEEDSentry is not aclaim that the glyph draws a mis-sized rule or that any test currently
fails, only that it is a candidate worth checking against a specific
construct. Most flagged rows (
\forall,\Im,\prime, the cmex10arrow/brace slots) are never used to draw a rule.
Not done
Nothing further for this issue — it is scoped as measurement-only. Following
up on any individual flagged row (the way
\ellwill need a fix) isout of scope here and would be its own oracle-by-oracle task.
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz