Repository navigation
render-pipeline: paint \prime with Latin Modern Math's unraised ssty prime; pin #278 geometry oracle - #528
Conversation
…prime (#278) What changed: - The prime's box geometry already matched pdflatex (compiler #174 and math-layout #172): script size, sup shift, one superscript for f'', f'^2 joining it, f_1'/x'_a sub+sup. What was wrong was the painted glyph. The pipeline drew cmsy "30 with Latin Modern Math's cmap glyph for U+2032 (`minute`, ink 430..748/1000 em). That glyph is pre-raised for unscripted Unicode use, so at the superscript position it sat 2.7-3.1bp too high at the bottom and 1.3-1.5bp at the top. - mathfont.rs reads the face's GSUB `ssty` lookups (AlternateSubst, plus Single and Extension). mathtex.rs paints cmsy "30 with the first ssty alternate, `minute.st` (ink 96..549, cmsy's unraised design; lmsy7 is 41..559). - tests/math_primes.rs pins the pdflatex \showbox oracle (10pt and 12pt, inline and display, f'(x) f'' f''' f^{\prime} f'^2 f_1' x'_a) for placement, and lmsy7/lmsy8 AFM ink for the prime, at 0.5bp. What was run: - cargo test --test math_primes (before fix): test result: FAILED. 1 passed; 1 failed - cargo test --test math_primes (after): test result: ok. 2 passed; 0 failed - render-pipeline full suite: every failure (letter_class_geometry 5, uline 2, underline_sout 4, xcolor_oracle 1) panics at src/adapter.rs:1261, the par-leading debug_assert that open PR #517 fixes; no other failures - math-layout and compiler: see PR Next step: re-check the Mac app rendering of f'(x) once this lands. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent independent review (subagent) Verdict: APPROVE Reviewed in a detached worktree (
No blocking findings. |
What
Refs #278. This verifies the geometry acceptance criteria against pdflatex and fixes the one mismatch it found: the glyph used to paint the prime.
tests/math_primes.rsnow pins that against a pdflatex\showboxoracle at 0.5 bp. It coversf'(x),f'',f''',f^{\prime},f'^2,f_1'andx'_a, at 10pt and 12pt, inline and in display. It checks each glyph's x offset from the base, its rise, its font size, and the advance of the whole superscript box. Every value matched within 0.001 bp before this change."30\primewith Latin Modern Math's cmap glyph for U+2032 (minute, ink 430..748 per mille). That glyph is pre-raised for unscripted Unicode use, so at the superscript position it was raised a second time. This matches the owner's report of a prime "sitting high".mathfont.rsnow reads the face's GSUBsstylookups (AlternateSubst, plus SingleSubst and Extension).mathtex.rs::otf_gidpaints cmsy"30with its firstsstyalternate,minute.st(ink 96..549). That is the unraised design cmsy uses (lmsy7 ink is 41..559).\showboxposition.Why
Issue #278's gate asks for box widths and the prime's vertical position within 0.5 bp of pdflatex. #315 only fixed the diagnostics side, and nobody had measured the geometry.
Oracle (TeX Live pdflatex,
article+ T1 + lmodern,\showbox). Positions are relative to the base glyph's origin, converted to bp. The ink rows are for the prime and give distances above the baseline.f': prime dx / rise / sizef': risef': dx / rise / sizef': risef_1': sub dropOverlap check
GH-278-PRIMES-GEOMETRYbefore mine. The oldGH-278claim was mine, and render-pipeline tests: pin script-style primes (f', g'', x^{\prime}, f'^2) — #278 is already fixed on main #315 was the diagnostics half.gh pr list --search prime: render-pipeline: math at the current text size, amsmath cmex designs, \dots/\bmod/\pmod spacing, one-letter \mathrm (needs #172 + #174 re-pin) #177 only (math at the current text size), which doesn't touch the prime paint path.cm.rs, the compiler or math-layout.render-pipeline/src/mathfont.rsandmathtex.rs, but in other hunks:is_script_capital,extra_symbol_slotand theTexMathMetricsconstructor. This PR adds a struct field, a constructor line, an accessor, a GSUB parser at the end of the file, and thebaseclosure inotf_gid.vendor/changes, so no re-pin is needed.Test results
cargo test --test math_primes, before the fix:test result: FAILED. 1 passed; 1 failed(ink test, 40 failures such as10pt inline f': prime ink bottom 6.6141 bp, pdflatex 3.9013 bp)cargo test --test math_primes, after:test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outsrc/adapter.rs:1261(letter_class_geometry5,uline2,underline_sout4,xcolor_oracle1). That is the par-leadingdebug_assert_eq!(leadings.len(), parsed.blocks.len())(left: 14 right: 13), which open PR compiler: boxed arguments and letter \ps no longer leave phantom paragraph leadings #517 addresses, and it is unrelated to math paint. There were no other failures: the lib and the 41 targets fromline_break_skip_macroon gave 273 passed, 7 failed; the targets before that passed apart fromletter_class_geometry.Not done
minute.stis not exactly lmsy's outline. After the fix, ink bottom is +0.38 bp at 10pt and +0.44 bp at 12pt, and the ink centre is +0.21 / +0.41 bp. All are within 0.5 bp, but the 12pt ink right edge is +0.53 bp. This comes from the design and is not a placement error; Latin Modern Math has no glyph closer to lmsy8's prime.MathFonts::glyph, used when the TFMs are missing, still maps U+2032 tominute. The default TFM path is fixed here; the fallback is not.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz