Repository navigation
Conversation
…ands
From the kernel-inventory-audit's Table 2, rows 22-41. Each test
asserts a real observable effect, read against the actual current
implementation (cited line numbers in the audit had drifted; commands
were located by name in expand.rs/parser.rs/math.rs/xref.rs/supported.rs
instead).
Found and documented, not fixed (per this slice's explicit scope) --
verified as real bugs by confirming the #[ignore]d tests actually FAIL
when run with --ignored, not just that they compile:
- \refstepcounter{c}\label{l} steps the counter correctly but \ref{l}
renders empty: \label captures only the parser's own current_counter,
never the engine-side \@CurrentLabel refstepcounter sets.
- \settowidth/\settoheight/\settodepth all always store 0pt: the
engine's DefaultBoxMeasurer is a documented zero placeholder: no real
box measurer is wired in yet.
Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane kernel-untested-b, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Muse-Lane-Head: 1a815ecb
Co-authored-by: muse-spark-1.3-contributor <[email protected]>
Fixes daniel-parent's REQUEST_CHANGES on #430 (several assertions were too loose to fail on a real regression): - \renewenvironment now asserts the exact item sequence [Yo, Bob, ?], so a stale end body ("!" leaking through) fails. - stepcounter asserts the exact order [M, 1, S, 0], so a swapped lookup ([M, 0, S, 1]) fails. - \scriptscriptstyle/\scriptstyle/\textstyle each assert exactly two items (p, q, nothing extra) plus q keeping p's font size -- the documented "zero-width no-op" relation, not just "p and q exist". - \rmfamily now also asserts the font is restored after the enclosing group closes, where a scoping leak would actually show up. - The four #[ignore]d known-bug tests (refstepcounter/\ref, \settodepth/\settoheight/\settowidth) now assert the CORRECT expected output instead of pinning the broken result, so a future fix won't break them. Each keeps a full issue-text reason (title, minimal input, expected vs actual) for filing. Mutation-tested: for each of the four tightened assertions, the old loose predicate was confirmed to still pass on the buggy output while the new tight one fails on it (exact before/after pairs in the PR). The four ignored tests were confirmed to genuinely fail with `--ignored` on this exact head, proving the bugs are real, not test-writing mistakes. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix430, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: muse-spark-1.3-contributor <[email protected]>
…vel tests Fixes daniel-parent's re-review of #430: 1. Added empty-diagnostics assertions to every non-ignored test that lacked them (a correct-looking result plus an error must fail). 2. Added a one-line doc comment to each test the review flags as parser-level rather than observable-output coverage (the TextStyle checks for rmfamily/sffamily/slshape/textmd/textnormal/upshape, and the \smallskip VSpace test), and noted that \stackrel's size and centring are unverified -- only the vertical stacking order is. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix430v2, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet)
The quotation test's comment claimed both margins were checked, but "Hi" is too short to wrap, so its right edge only reflects the glyph width, not the block's right margin. Reworded the comment and assertion message instead of adding an unverified right-margin assertion. Implementation-Agent: daniel-muse-lead (Claude Sonnet) Commit-Executor: daniel-muse-lead (Claude Sonnet)
Replaces the engine's zero-reporting DefaultBoxMeasurer placeholder: width shapes the (brace-stripped) content with layout::text_width at the default body baseline (Times-Roman, 12pt); height/depth report the face's real AFM ascender/descender. Fixed baseline is unavoidable: the trait passes no font/size context. Implementation-Agent: muse-spark-1.3-contributor
Pins end-to-end \settowidth/\settoheight/\settodepth via \the: 12.0pt width for 'Hi' (Times advances 722+278 at 12pt), 8.196pt height (AFM ascender 683), 2.604pt depth (|descender| 217), plus grows-with-text. Implementation-Agent: muse-spark-1.3-contributor
…niel-muse-lead/boxmeasurer #430's kernel_untested_b.rs already had these three tests written and correctly asserting positive/growing values, just #[ignore]d pending a real BoxMeasurer. Resolved by keeping #430's version of the file and removing only the three BoxMeasurer-related #[ignore] attributes (not touching the separate #[ignore]d refstepcounter test, which #486 fixes independently) -- no new hardcoded-value tests needed since #430's own assertions (positive, grows with text) already hold under the real measurer. Implementation-Agent: daniel-muse-lead (Claude Sonnet) Commit-Executor: daniel-muse-lead (Claude Sonnet)
|
daniel-parent review (subagent) Verdict: CHANGES NEEDED Precheck: no hard-rule violations (no vendor/ edits; claim WARN is the missing Findings. Values are
Note, not blocking: in the compiler, a measured length currently reaches nothing but Marking back to draft until 1-3 are addressed. |
Slice 1 stringified the argument via tokens_to_display_string and
measured once at plain Times-Roman, so \settowidth{\w}{\textbf{Hi}}
reported the width of the literal characters '\textbf Hi' (46.15pt).
The measurer now walks the engine tokens the way the paragraph-body
pass walks parser tokens (Parser::inlines_from_tokens): the same
style_command/style_declaration table drives the same apply_style
transitions over the same group/pending discipline, producing styled
runs that are each shaped with layout::text_width at their own
(style_font, size) and summed. ~ (active char only) measures as a
tie: word_space at the font in force, matching the render pipeline's
tie arm; a catcode-other ~ still shapes as a tilde glyph, as TeX
sets it. settoheight/settodepth take the max font_extents over the
runs (the hbox rule), so {\Large X} uses Large metrics; run-less
content keeps the body baseline-face fallback. Non-text constructs
(math, logos, rules, graphics) contribute no width, mirroring the
flat pass's drop arm — documented in code.
Implementation-Agent: muse-spark-1.3-contributor
|
Fix pushed (`282c806a`) — did NOT hit the stop condition (a `\setto...` argument is restricted horizontal mode, a plain hbox, so style-aware run summation is the correct model, not an approximation needing the line-breaker or render-pipeline/tex-boxes work). `measurable_text`'s flat stringify replaced with `styled_runs`, which walks the token stream through the SAME `style_command`/`style_declaration`/`apply_style` machinery the normal paragraph-body parser uses, producing styled text runs each measured at their own font/size via `layout::text_width`; `height`/`depth` take the max `font_extents` across runs (so `{\Large X}` uses Large metrics). ` Independently verified: 6/6 focused tests pass. Mutation check (fresh `CARGO_TARGET_DIR`): forced the width measurement back to a fixed Times-Roman font regardless of style → `settowidth_measures_textbf_at_bold_width` FAILED (`bold Hi measures 12pt, expected 12.672pt`); restored → passes. Entry-point repro (`handle_line`): `\settowidth{\w}{\textbf{Hi}}\the\w` now prints `12.672pt` (measuring actual bold "Hi"), not the old 46.15pt literal-text bug. |
…d/boxmeasurer # Conflicts: # crates/compiler/src/layout.rs # crates/compiler/tests/kernel_untested_b.rs
Block::VSpace gained stretch_pt/shrink_pt fields on main after this branch diverged; kernel_untested_b.rs's own test helper still matched the old pt-only shape.
… known-wrong zero measurement (issue #448) Corrects this PR's own earlier commit. \settowidth executes with zero diagnostics, which is exactly why it must stay listed: the expansion pass measures through DefaultBoxMeasurer, a documented stub that reports zero for everything, and nothing in crates/compiler ever calls set_box_measurer to replace it -- so `\the` reads back the stored length as 0.0pt, silently. Before this PR's original commit the vocabulary at least warned "unimplemented" (loud and wrong); removing that warning converted it to silent and wrong, the failure mode this project treats as unacceptable. Confirmed directly: `\newlength{\mylen}\settowidth{\mylen}{Hello}\the \mylen` prints "0.0pt" with zero diagnostics on this branch. `\newlength` itself stays delisted -- it only allocates a register, no measurement involved, and is genuinely fine on its own. Adds settowidth_still_measures_zero_and_stays_listed, pinning the current known-wrong 0.0pt output together with the vocabulary entry: when a real BoxMeasurer lands (issue #492) and the value stops being 0.0pt, that test failure is the correct signal to delete both the entry and the test in the same change -- not to "fix" the test by re-suppressing the question. Tests: crates/compiler full suite green, 0 failures. Independently re-verified by the reviewer with a fresh cargo test run. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane settowidth-revert, slice 1) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet) Reviewed-by: daniel-muse-lead-2 (Claude Sonnet) Muse-Lane-Head: 2cfee13f46855175aae35300717a0592559dfcff Co-authored-by: d-q222 <[email protected]>
The doc comment already said this test going red is the expected signal of a real BoxMeasurer landing; now each assertion's failure text says so itself, naming both follow-up actions, per daniel-parent's review on #2: a red test must explain itself to whoever sees it, not rely on an external chat thread. Tests: crates/compiler full suite green, 0 failures. Independently re-verified by the reviewer. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane settowidth-message-fix, slice 1) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet) Reviewed-by: daniel-muse-lead-2 (Claude Sonnet) Muse-Lane-Head: 2d030a19aa089b03c776d58b3c757600494ec879 Co-authored-by: d-q222 <[email protected]>
|
Commander (daniel-parent): independent Codex review (gpt-5.6-luna max) of
VERDICT: CHANGES REQUIRED |
…492) An independent Codex review of fda25c5 found 7 major bugs and 1 minor bug in the BoxMeasurer for \settowidth/\settoheight/\settodepth. 1 (checkpoint loses the measurer, blocker): documents containing \settowidth/\settoheight/\settodepth now skip the incremental cache entirely (new has_setto, mirroring the existing has_includes check for \input/\include), so a box is always measured through the full expansion path with a fresh measurer attached. The ideal fix -- carrying the measurer through Checkpoint/Engine::restore -- needs a tex-expansion change outside this PR's scope; this is the same category of mitigation already used for \input/\include. 2 (font context ignored, blocker): CompilerBoxMeasurer now resolves sizes against the document's class-option size (DocumentFonts::class_pt) instead of a hardcoded BODY_SIZE_PT. The outer-\ttfamily half of this finding is NOT addressed: the BoxMeasurer API only receives box-content tokens, never the engine's active font state, which also needs a tex-expansion change. 3 (math treated as text): $...$/\(...\)/\[...\] content now contributes 0 and records a "math inside \settowidth, ... is not measured accurately yet" diagnostic at the opener's span, instead of measuring the literal delimiters as roman text. 4 (unsupported commands silently dropped): \hspace[*]{len} now sets its parsed glue; text symbols resolve via text_symbol (\textasciitilde is a real tilde width); text kerns resolve against the size in effect; fills and \- are zero natural width; every other unmeasurable control sequence now records a diagnostic instead of silently vanishing or measuring stray argument text. 5 (space font/spacefactor): deferred spaces now charge the style recorded at the space itself, not the style active when the next character is seen, fixing e.g. \settowidth{\w}{a \texttt{b}}. \spacefactor stays unimplemented -- the layout engine itself has no spacefactor model, so inventing one in the measurer alone would diverge from layout with no fontdimen data to ground it. 6 (empty/glue-only boxes get face extents): empty boxes are now exactly 0pt height and depth; nonempty text additionally requires an actual descender glyph for depth (new TEXT_DESCENDER_GLYPHS table, reused from the underline layout code) instead of the whole-font descender. 7 (group boundaries split shaping runs): adjacent same-style runs across a transparent {} group now merge before ligature/kerning, so \settowidth{\w}{A{}V} measures the same as \settowidth{\w}{AV}. 8 (tests compared against the implementation's own helpers): the three self-referential kernel_untested_b.rs assertions now pin literal AFM Times-Roman/Courier/Times-Bold advances from the in-repo generated font metrics -- independent ground truth in the absence of a local pdflatex, clearly noted as pending a real oracle run. Tests: expansion_incremental.rs gains a checkpoint-restore regression (finding 1); kernel_untested_b.rs gains one test per finding reproducing the review's exact example, each proven to fail pre-fix and pass post-fix. Full cargo test --locked in crates/compiler (independently re-run by the supervisor): 77 test binaries, 926 passed, 0 failed, 7 pre-existing ignores. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane boxmeasurer-review-fix, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: d-q222 <[email protected]>
|
daniel-muse-lead: pushed
Full |
|
Commander (daniel-parent): independent Codex re-review (gpt-5.6-luna max) of Finding 2 (Core14 Times/Helvetica/Courier instead of TeX TFM metrics) is NOT a blocker here. Blockers to fix, daniel-muse-lead: 1 (enclosing font state dropped,
VERDICT: CHANGES REQUIRED |
A third independent review found the two original blockers fixed and 10
more issues. Per the Commander's ruling, the Core14-vs-TFM metrics gap
(the first half of finding 2) is not a defect in this crate's scope, but
the 12pt-fallback bug in the same finding is real.
Fixed:
- 2 (half): an omitted class size fell back to a hardcoded 12pt instead
of the class's real default (10pt for standard classes) -- now uses
FontSetup::class_pt.
- 3: em/ex in \hspace resolved against body size instead of the active
font -- now uses the active font's em_ex_sp (TeX's own fixed-point
refinement), matching the parser's private helper for the same
computation.
- 4: \quad/\qquad/\enskip and \hskip fell through as unmeasured -- new
arms mirror the parser's own horizontal-glue handling; \hskip consumes
a full TeX <glue> spec (fixed part kept, stretch/shrink dropped, per
spec).
- 5: math and unsupported inlines silently stored a near-zero width --
now fail loudly (a real engine error, not a warning), so a \settowidth
with math in its argument tells the author instead of lying.
- 6: height/depth used the whole face ascender and a hardcoded character
allowlist -- now class-aware face metrics (tall-glyph ascent vs
x-height; an extended deep-glyph set for depth), since true per-glyph
ink boxes don't exist in this font stack.
- 7 (half): the cache bypass now also catches \csname settowidth\endcsname
-style dynamic invocation, closing the specific 0pt-after-restore
failure the review demonstrated. The full fix (the measurer travelling
with Checkpoint) needs a tex-expansion change -- see the diagnosed
finding 1 below for the same underlying constraint.
- 8: text kerns ignored amsmath's renewed \, definition -- now detects
\usepackage{amsmath} and passes it through.
- 9: the incremental regression test was vacuous (it happened to bypass
caching without asserting so) -- now asserts the bypass explicitly and
adds a dynamically-constructed-command case.
Diagnosed, not fixed (both need scope outside crates/compiler):
- 1 (enclosing font state dropped): the engine's BoxMeasurer trait
boundary never receives the font in force around \setto..., and no
in-scope mechanism can observe it. A concrete follow-up sketch is in
the PR body: thread a font id through the three BoxMeasurer methods,
pass it at the three call sites in tex-expansion's expand.rs, and
carry the measurer through Checkpoint/Engine::restore (this also
finishes finding 7).
- 10 (pin pdfLaTeX oracles instead of Core14/AFM values): no committed
pdfLaTeX oracle exists for these Times-shaped boxes, and none could be
generated that would validate anything, since pdflatex sets cmr while
this compiler intentionally shapes Times for \setto... today.
Tests: 8 new tests in kernel_untested_b.rs plus 1 new + 1 strengthened in
expansion_incremental.rs, each reproducing the review's exact example and
proven to fail pre-fix, pass post-fix. 7 pre-existing tests that pinned
the old (buggy) 12pt default were given an explicit [12pt] option so
their expected values stay meaningful.
Full cargo test --locked in crates/compiler (independently re-run by the
supervisor): every target ok, 0 failed.
Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane boxmeasurer-review-fix-2, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Co-authored-by: d-q222 <[email protected]>
|
daniel-muse-lead: pushed Finding 1 (enclosing font state), follow-up sketch for whoever picks it up: the engine's Finding 10: no committed pdfLaTeX oracle exists for these Times-shaped boxes, and none could validate anything — pdflatex sets cmr while this compiler intentionally shapes Times for Full |
|
Commander (daniel-parent): independent Opus round-3 review of PR #492 —
|
| box | pdflatex | this PR |
|---|---|---|
\hskip 1 em A |
17.50003pt | 29.44pt (Warning) |
\hskip 1em A |
17.50003pt | 17.22002pt (clean) |
68% over, from a construct TeX accepts. The severity is also inverted relative
to finding 2 below: this 12pt error is a warning, while \& (a 3pt error)
is an error.
Fix: in take_word, after a run of digits/sign/decimal, skip <optional spaces> and take the unit word, as scan_dimen does. Same treatment for the
plus/minus clause values. If the rejoin is genuinely not wanted, the
fallback must at least not measure the leftover spec as text — consume it and
warn, or promote the note to an error so the caller knows the width is wrong.
2. Escaped specials and accents now raise Severity::Error on documents pdflatex compiles fine
TEXT_SYMBOLS (text_builtins.rs:29-89) holds no escaped specials (\&, \%,
\_, \$, \#, \{, \}) and no accent commands, so every one of them falls
to the catch-all TexKind::ControlSequence(name) arm, which calls fail(...) —
an error, not a warning, since round 2. Measured:
| box | pdflatex | this PR | diagnostic |
|---|---|---|---|
A\&B |
22.36118pt | 13.89pt | Error \& ... not measured accurately yet |
50\% |
— | 10.0pt | Error \% |
a\_b |
— | 9.44pt | Error \_ |
a\$b |
— | 9.44pt | Error \$ |
a\{b |
— | 9.44pt | Error \{ |
caf\'e |
16.94447pt | 16.65pt | Error \' |
\settowidth{\mywidth}{R\&D} is an ordinary line of LaTeX; after this PR it
produces a red error and a width short by the &. Round 1 at least only
warned. The finding asked that supported inlines be "measured or explicitly
diagnosed, never silently valued wrong" — these are neither measured nor
legitimately undiagnosable: \&/\%/\_/\$/\{/\} are single characters
the compiler resolves everywhere else, and the accents go through the same
text_symbol/encoding path the measurer already calls for \textasciitilde.
Fix: add an arm ahead of the catch-all for the escaped specials (map the
control-symbol name straight to its character) and route the accent commands
through the existing encoding path; keep fail for genuinely unmeasurable
content (rules, graphics, logos, tabulars). At minimum, demote this class from
fail to note so valid documents do not error.
3. Height and depth are still the whole-face ascender/descender selected by a hardcoded character list
is_tall_glyph and is_deep_glyph (expansion.rs) are two new hardcoded
character lists, and both branches return face-level metrics from
run_vertical_pt — Core14Face::new(font).vertical_metrics(). No per-glyph ink
extent is read anywhere. The doc comment's justification is accurate as far as
it goes (crates/font-engine/src/lib.rs:196 exposes only a face-level bbox(),
and generated.rs stores widths and kern pairs but no per-char B boxes), but
the Adobe AFM sources the tables are generated from do carry a bounding box
per character; emitting them is a tools/gen_tables.py change, not new
architecture. Nothing in the code or in an issue tracks that.
Measured consequences (pdflatex cmr10 vs this PR; these are class-assignment
errors, not the out-of-scope Core14/TFM difference):
| box | op | pdflatex | this PR |
|---|---|---|---|
? |
height | 6.94444pt | 4.5pt (x-height class) |
! |
height | 6.94444pt | 4.5pt (x-height class) |
, |
height | 1.05554pt | 4.5pt (x-height class) |
( |
height | 7.5pt | 6.83pt (capped at the ascender) |
( |
depth | 2.5pt | 2.17pt (capped at the descender) |
x |
height | 4.30554pt | 4.5pt (class correct) |
X |
height | 6.83331pt | 6.83pt (class correct) |
p/Q/, |
depth | 1.94444pt | 2.17pt (class correct) |
? and ! reach the ascender in every text face and are simply missing from
is_tall_glyph; , is in neither list's spirit (it is short and deep) and
gets a height 4.3x too large. Note also that TeX distinguishes cap height
(X 6.83331) from ascender (? 6.94444); one face constant cannot express
both.
Secondary: settodepth_measures_comma_depth (tests/kernel_untested_b.rs:701)
asserts 2.604pt at 12pt, i.e. the Times face descender 217/1000, and names it
"comma depth". Times-Roman's comma bounding box is B 56 -141 220 102 — depth
141/1000. The test cements the face-level approximation under a name that
claims per-glyph accuracy.
Fix: emit per-character B boxes from tools/gen_tables.py, expose a
glyph_extents(ch) on Core14Face, and take the max over the characters
actually present — which also deletes both hardcoded lists. If that must wait,
file and reference a tracking issue at run_vertical_pt, rename the comma test
to what it measures, and at least add ?, !, @, #, $, %, &, *,
? and friends to is_tall_glyph so the common punctuation is not classified
as x-height.
Non-blocking notes
build_cache(expansion.rs:2188) callsconfigure_with_fonts(engine, fonts)
and drops the returnedRc<CompilerBoxMeasurer>, so on the incremental path
the measurer's notes are never drained. Today that path is unreachable for
boxes becausehas_settoforces the full run, but the guard is a substring
scan of the entry document only. Adebug_assert!(measurer.take_notes() .is_empty())there would turn any futurehas_settomiss into a test
failure instead of silently swallowed diagnostics.\quadadvancesQUAD_EM * run_size_pt(a nominal 10.0pt at the 10pt class)
while\hspace{1em}advances\fontdimen6(10.00002pt). 0.00002pt — cosmetic,
but two different ems in one measurer is a trap for the next reader.run_size_ptresolves against the rawsetup.class_pt(11.0 for the 11pt
class) whileem_ex_spgoes throughFontSetup::size_pt(10.95). This
matches the compiler's documented 11pt approximation
(size_declaration_pt's comment), so it is consistent rather than wrong —
recorded so it is not mistaken for a new divergence.\hfill/\hfil/\hss/\-contributing zero natural width with no
diagnostic is right: an hbox takes the natural width, and TeX agrees.
Tests run
From crates/compiler, nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target cargo test --locked <filter>:
--test kernel_untested_b— 39 passed, 0 failed, 1 ignored.--test expansion_incremental— 10 passed, 0 failed (92s).--test kernel_untested_bwith4b99ffce'sexpansion.rsrestored —
31 passed, 8 failed, all eight being the round-2 tests (worktree restored
afterwards).- A temporary probe test was used to read measured values and diagnostics
directly; it was deleted and the worktree left clean.
Oracle probes (pdflatex, TeX Live 2026, 10pt article): width/height/depth of
x, X, ?, !, ,, p, (, Q, t, Hi, {}, AB, A\quad B,
A\enskip B, A\enspace B, A\&B, caf\'e, \hskip 1 em A, \hskip 1em A.
VERDICT: CHANGES REQUIRED
…ts (#492 review round 3) A fourth independent review found 3 more issues in the BoxMeasurer. 1 (a unit split from its number by a space wasn't rejoined): TeX's <unit of measure> is <optional spaces><internal unit>, so \hskip 1 em is one em -- this measurer previously rejected it, and the leftover "1 em" text then got shaped as glyphs (68% over pdflatex's width). New take_dimen_word skips TeX's <optional spaces> between a number and its unit, mirroring scan_dimen; used for the base dimension and the plus/minus clause values (the plus/minus keywords themselves still use the old maximal-run matching, since a keyword must not swallow its value). 2 (escaped specials and accents raised Severity::Error on documents pdflatex compiles fine): \&, \%, \_, \$, \#, \{, \} fell to the catch-all control-sequence arm, which now calls fail() (an error) since round 2 -- so \settowidth{\w}{R\&D} produced a red error on ordinary LaTeX. New arm maps these seven straight to their character, matching how the lexer resolves them everywhere else. Kernel text accents (\c \v \u \H \r \k \d \b, plus capital-accent aliases) now route through the existing text_symbol/text_accent encoding path instead of failing, with the same diagnostics that path already uses (silent for a precomposed char, warning for NoComposite, error for Unavailable). 3 (height/depth from whole-face metrics via a hardcoded character list): the full fix needs per-character AFM bounding boxes threaded through font-engine's generated tables, which is cross-crate table work too large for this slice. Took the minimal fallback the review allowed: added the common tall punctuation (? ! @ # $ % & *) missing from is_tall_glyph, renamed settodepth_measures_comma_depth to settodepth_approximates_comma_depth_with_face_descender to stop it overclaiming per-glyph accuracy, and filed the remaining gap as a tracking issue (comma's height, and the general per-glyph fix, remain open). Tests: 4 new tests in kernel_untested_b.rs, each reproducing the review's exact example, failing pre-fix and passing post-fix. Full cargo test --locked in crates/compiler (independently re-run by the supervisor): every target ok, 0 failed. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane boxmeasurer-review-fix-3, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: d-q222 <[email protected]>
|
daniel-muse-lead: pushed
Full |
|
Commander (daniel-parent): independent Opus review of
PR #492 — round 4 review (head 3769c41, base dbe3cac)Reviewer: opus, independent, read-only. Oracle: Round-3 finding 1 —
|
| source | pdflatex |
|---|---|
\settowidth{\w}{\hskip 1em A} |
17.50003pt |
\settowidth{\w}{\hskip 1 em A} |
17.50003pt |
\settowidth{\w}{\hskip 1 em A} (two spaces) |
17.50003pt |
\settowidth{\w}{\hskip 1em plus 2 pt minus 1 pt A} |
17.50003pt |
\settowidth{\w}{\hskip 1 e m A} |
! Illegal unit of measure (pt inserted), 27.94447pt |
take_dimen_word (crates/compiler/src/expansion.rs:1116-1148) takes the
number run, skips spaces, then takes a maximal alphabetic run — so it joins
1 em and 1 em and does not join 1 e m (it yields 1e, which
parse_dimen_font_pt rejects, leaving *i untouched). That is exactly TeX's
pair of rules. Measured at 3769c41: joined/spaced/spaced2/pm all
17.22002pt with no diagnostic — the 0.28pt against pdflatex is entirely the
agreed Core14 substitution (cmr10 A 750/1000 vs Times-Roman 722/1000); the
1em part is 10.00002pt in both. The spec text is no longer shaped:
17.22002 = 10.00002 (em) + 7.22 (A) exactly, with no glyphs for 1, ,
e, m. The plus/minus clause values rejoin too, as pdflatex does.
Not a defect, recorded for completeness: on the invalid \hskip 1 e m,
recovery diverges (pdflatex inserts 1pt and sets e m, 27.94447pt; flashtex
warns and sets 1 e m, 31.94pt).
Round-3 finding 2 — escaped specials fixed; accents only half fixed
Material finding 1: the seven punctuation-named accents still raise Severity::Error on documents pdflatex compiles clean
crates/compiler/src/expansion.rs:1527 gates the new accent arm on
is_box_accent, i.e. TEXT_ACCENTS (crates/compiler/src/text_builtins.rs:155
= c v u H r k d b) plus CAPITAL_ACCENT_ALIASES. \', \`, \^,
\", \~, \= and \. are in neither, so they fall through to the generic
unknown-control-sequence arm and measurer.fail(...).
Measured at 3769c41, each row is the same text compiled twice — once as
running text, once inside \settowidth:
| source | paragraph pass | inside \settowidth |
|---|---|---|
Caf\'e x |
no diagnostics | Error: \' inside \settowidth, \settoheight or \settodepth is not measured accurately yet |
Caf\`a x |
no diagnostics | Error: \ …` |
Caf\^o x |
no diagnostics | Error: \^ … |
Caf\"u x |
no diagnostics | Error: \" … |
Caf\~n x |
no diagnostics | Error: \~ … |
Caf\=e x |
no diagnostics | Error: \= … |
Caf\.z x |
no diagnostics | Error: \. … |
\'{\i} |
no diagnostics | Error: \' … |
Caf\c{c} x, \v{s}, \u{g}, \H{o}, \r{a}, \d{h} |
no diagnostics | no diagnostics ✔ |
pdflatex compiles all of them without a single ! line (Caf\'e h=8.33331pt
w=23.17337pt; \'{\i} h=8.33331pt w=3.26385pt).
Round 3's finding 2 named \' explicitly (it appears there as \x27), and the
round-4 commit message and the code comment both say "kernel text accents …
no longer raise errors". That is true only of the eight letter-named accents.
\'e/\"u/\~n are the commonest accents in real prose, so a document that
renders fine today starts failing the moment the same words are put inside a
\settowidth.
Failure scenario: \newlength{\w}\settowidth{\w}{Caf\'e} — one Severity::Error
diagnostic on a valid document, and a width of 26.23pt that silently omits the
accent.
Fix: text_builtins.rs:162-176 already documents that these seven are
unimplemented compiler-wide — the lexer emits them as escaped-literal words, so
the paragraph pass sets a literal quote plus the letter with no diagnostic.
The measurer should mirror that pass (set the same literal fallback, emit at
most the same diagnostic) rather than raising an Error. Whatever the width
ends up being, a box measurement must not fail a document the running text
accepts.
Widths, not merely non-erroring: correct
Checked against the compiler's own Core14 path, exact to the last digit:
Caf\& x= 29.72pt = (667+444+333+778+250+500)/1000 × 10 ✔\&\%\_\$\#\{\}= 40.71pt = (778+833+500+500+500+480+480)/1000 × 10 ✔\c{c}= 4.44pt = the Times-Romanccedillaadvance — and pdflatex's
\c{c},\c cand literalçare all 4.44444pt, so this one agrees with
pdflatex outright ✔\k{a}reportsLaTeX Error: Command \k unavailable in encoding OT1, which
is the real LaTeX error under OT1 ✔
Non-blocking: settowidth_measures_escaped_specials_as_characters asserts
against text_width("R&D", 10.0, Font::TimesRoman) — the same function under
test — so it proves the escape resolves to the right character, not that the
width is right. Worth saying so in the comment; the independent check above is
the AFM arithmetic.
Round-3 finding 3 — height/depth classes
Material finding 2: the clause that was extended still has dead entries, and \_ is newly wrong
crates/compiler/src/expansion.rs:1219-1227. The "punctuation drawn
full-height" list the round-4 commit extended contains ', ` and ",
but the compiler's own apply_text_ligatures rewrites '→U+2019,
`→U+2018, ''→U+201D and ``→U+201C before is_tall_glyph ever
sees them, and none of the curly characters is in the list. So those entries
can never fire for real source. Measured at 12pt:
| source | flashtex \settoheight |
pdflatex | Times-Roman AFM ink |
|---|---|---|---|
' |
5.4pt (x-height tier) | 8.33331pt | quoteright 676 → 8.112pt |
` |
5.4pt | 8.33331pt | quoteleft 676 → 8.112pt |
'' |
5.4pt | — | quotedblright 676 → 8.112pt |
" |
8.196pt | 8.33331pt | quotedbl 676 → 8.112pt |
\_ is the other half. It became measurable only through this round's
escaped-special fix (it raised an Error at 4b71f72), and it now reports
height 5.4pt and depth 0.0pt, where pdflatex gives height 0.4pt and
Times-Roman's underscore bbox is -8 -109 508 -75 — the glyph lies entirely
below the baseline, so its height is ≈0 and its depth ≈1.308pt at 12pt. A
13× height error, silently, on a character the PR just enabled.
Fix: at minimum add U+2018/U+2019/U+201C/U+201D to the tall list and give _
a short-and-deep classification; #832's glyph_extents is the real fix, but
#832's text mentions neither the dead quote entries nor the newly reachable
escaped specials, so nobody working from it would find them.
The added eight: right class, approximate magnitude
? ! @ # $ % & * were all in the x-height tier before and are all well above
it in reality, so every one of the eight is an improvement and none of the
previously-correct characters changed class (the round-4 diff to
is_tall_glyph is exactly those eight characters; the only other change in the
area is a test rename, settodepth_measures_comma_depth →
settodepth_approximates_comma_depth_with_face_descender, with the assertion
unchanged at 2.604pt). Measured against real metrics at 12pt:
| glyph | flashtex | Times-Roman AFM ink | pdflatex (cmr12) |
|---|---|---|---|
? ! @ % & * |
8.196pt | 676 → 8.112pt | 8.33331 / 8.33331 / 8.33331 / 9.0 / 8.33331 / 9.0 |
# |
8.196pt | 662 → 7.944pt | 8.33331pt |
$ |
8.196pt | 727 → 8.724pt | 8.9978pt |
$ is the outlier: its ink genuinely exceeds the face ascender, so the tall
tier under-measures it by 0.53pt and no ascender-based class can ever be right
for it. Non-blocking (that is #832's subject), but the new test
settoheight_classes_full_height_punctuation_as_tall asserts 8.196 ± 0.02 for
all eight — it pins the approximation, while its comment ("?, ! and friends
reach the face ascender … AFM Times-Roman ascender is 683/1000em") reads as a
per-glyph metric claim, which it is not.
Still unfixed and correctly deferred to #832: , measures 5.4pt height
(x-height tier) against pdflatex's 1.16666pt and Times comma ink 102 →
1.224pt; ., -, : are the same family.
The tracking issue: exists, accurate, not linked from the code
#832 ("compiler: settoheight/settodepth use whole-face metrics via hardcoded
glyph lists instead of per-glyph ink extents") is open, names the exact
functions, the exact data gap (tools/gen_tables.py emits only the face
FontBBox), the ?/!/, cases and the test rename, and proposes the right
fix. But grep -n 832 crates/compiler/src/expansion.rs crates/compiler/tests/kernel_untested_b.rs returns nothing: the doc comment
says only "as a minimal stand-in for per-glyph ink extents" and the renamed
test says "a separate tracking issue". The number needs to be in both places.
Non-blocking notes
\d{h}diverges between the two passes: the paragraph pass warns
"Times-Roman has no glyph for 'ḥ' (U+1E25)", the measurer sets it silently at
zero width (Caf\d{h} x= 21.94pt vsCaf\b{h} x= 26.94pt). Pre-existing
family, but the measurer is meant to mirror the paragraph pass's diagnostics.- The unit run is still maximal, so
\hskip 1emphasis(TeX: 1em then the
literalphasis) is rejected whole rather than split. Unchanged by this
round; invalid-ish input, low value. \capitalacute{A}raises the "not measured accurately yet"Error— same
root cause as material finding 1 (its canonical\'is unimplemented), and
theCAPITAL_ACCENT_ALIASESdoc comment already says those seven aliases are
deliberately absent, so the import buys nothing for them.- The PR body has no round-3/round-4 update section: it still describes the
original slice, still says "22 passed; 1 ignored" for
kernel_untested_b(it is now 43 passed, 1 ignored), and never mentions
compiler: settoheight/settodepth use whole-face metrics via hardcoded glyph lists instead of per-glyph ink extents #832.
Tests run
crates/compiler:cargo test --locked --test kernel_untested_bat
3769c41 — 43 passed, 0 failed, 1 ignored.- Same filter with
expansion.rsreverted to4b71f728— 39 passed,
4 failed:settowidth_measures_hskip_with_space_between_number_and_unit,
settowidth_measures_escaped_specials_as_characters,
settowidth_measures_text_accents_without_error,
settoheight_classes_full_height_punctuation_as_tall. All four are genuine
regression tests. crates/compiler:cargo test --locked(whole crate) — 77 result lines,
0 failed.- Three throwaway probes appended to
kernel_untested_b.rsfor the measured
tables above; all removed, worktree left clean at 3769c41. - pdflatex oracles:
w.tex(glue specs, escaped specials, cedilla),
w2.tex(split unit),h.tex(heights/depths at 12pt),a.tex(accents,
quotes,\_,\$, parens).
VERDICT: CHANGES REQUIRED
… underscore height (#492) BoxMeasurer review follow-ups. 1. The seven punctuation accent commands (\', \`, \^, \", \~, \=, \.) errored inside \settowidth/\settoheight/\settodepth: the measurer matched only letter-named accents, so these fell to the catch-all error arm. They now set their literal character with no diagnostic, the same way the compiler's own lexer reads them in running text. 2. is_tall_glyph's U+FB00-U+FB04 arms were dead: apply_text_ligatures only builds quote/dash ligatures, so nothing ever produces those code points. Removed; verified no behavior change (all five are already tall via the lowercase-non-ASCII branch). 3. \settoheight{\_} took the x-height tier (5.4pt at 12pt); real OT1 \_ is a \vbox{\hrule} with a 0.4pt rule (verified against a real pdflatex \showthe\ht0 probe and the latex.ltx source). An underscore-only run now measures 0.4pt. 3 new regression tests. Full crates/compiler suite green (every target ok, 0 failed), independently re-run on the exact published tree. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane settowidth-accents, slice 1) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet) Reviewed-by: daniel-muse-lead-2 (Claude Sonnet) Muse-Lane-Head: 7137e1b774bf2d80ef7ecb09f0c95df6d313e080 Co-authored-by: d-q222 <[email protected]>
|
daniel-muse-lead-2 (Muse Contributor lane
3 new regression tests, full Produced by a supervised Muse Contributor lane ( |
|
Commander (daniel-parent): independent Opus review of
PR #492 — review round 7 (independent, read-only)Head verified: Oracle / exact preamble for every measurement belowpdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026). Every pdflatex number below comes No The compiler side is Out of scope as directed and not re-raised below: Core14 vs TeX TFM metrics Status of the three findings the author reports fixed(1) Seven punctuation accents raised
|
| body | pdflatex \ht0 |
compiler \settoheight |
|---|---|---|
' |
8.33331 pt | 5.4 pt |
` |
8.33331 pt | 5.4 pt |
'' |
8.33331 pt | 5.4 pt |
`` |
8.33331 pt | 5.4 pt |
" (straight, never ligated) |
8.33331 pt | 8.196 pt ✓ |
x (control) |
5.16667 pt | 5.4 pt ✓ |
5.4 pt is Times' x-height at 12 pt, i.e. exactly the x-height tier the round-6 finding
named. See MATERIAL finding 1.
(3) \_ height 5.4 pt where pdflatex gives 0.4 pt — fixed for height, not width
Height is now right and matches pdflatex exactly:
| body | pdflatex \ht0 |
compiler \settoheight |
|---|---|---|
\_ at 10 pt |
0.4 pt | 0.4 pt ✓ |
\_ at 12 pt |
0.4 pt | 0.4 pt ✓ |
x\_ |
5.16667 pt (x-height wins) | 4.5 pt (Times x-height at 10 pt) ✓ tier |
\_ depth |
0.0 pt | 0.0 pt ✓ |
The all(|c| c == '_') guard at expansion.rs:1677-1679 gets the mixed case right.
But the width was left on the old glyph model — see MATERIAL finding 3.
MATERIAL findings
1. crates/compiler/src/expansion.rs:1230 — the ' and ` arms of
is_tall_glyph are still unreachable, so every quote measures at the x-height tier.
is_tall_glyph has exactly one call site, expansion.rs:1676, and it is fed
apply_text_ligatures(&run.text). lexer.rs:114-137 maps ` → U+2018,
' → U+2019, `` → U+201C, '' → U+201D unconditionally, so a bare ' or
` can never reach is_tall_glyph. None of U+2018/U+2019/U+201C/U+201D is
char::is_uppercase, and none satisfies is_lowercase() && !is_ascii(), so all four
fall through to x_height.
Failure scenario: \settoheight{\l}{``quoted''} — and every \settoheight over
running text whose tallest character is a quote — stores 5.4 pt where pdflatex stores
8.33331 pt, a 35% under-measure. Anything sized off that register (a \parbox,
\raisebox, a rule under a quoted word) is laid out short. It also hits
\textquoteright/\textquotedblleft, which TEXT_SYMBOLS resolves to the same code
points at expansion.rs:1505-1506. This is the round-6 finding verbatim; the round-7
commit changed a neighbouring range instead.
Fix: the function is only ever called post-ligature, so the ASCII forms are the ones
that cannot occur. Replace them:
| '(' | ')' | '[' | ']' | '/' | '\\' | '|' | '"'
| '\u{2018}' | '\u{2019}' | '\u{201C}' | '\u{201D}'(keep '"', which is never ligated and does measure 8.196 pt today) and extend
settoheight_keeps_ascender_f_without_f_ligature_arms's shaping assertion to pin that
'/` shape to U+2019/U+2018, so the next reader cannot re-add the dead forms.
2. crates/compiler/src/expansion.rs:1543-1553 — the punctuation accents are
measured as two glyphs; pdflatex measures one.
The new arm pushes the command name as a literal character, so \'e is measured as
' followed by e. TeX's \accent never advances the width: the accented box is the
width of the base letter alone.
| body | pdflatex \wd0 |
compiler \settowidth |
ratio |
|---|---|---|---|
\'e |
5.22217 pt | 9.324 pt | 1.79× |
\`e |
5.22217 pt | 9.324 pt | 1.79× |
\^e |
5.22217 pt | 10.956 pt | 2.10× |
\"e |
5.22217 pt | 10.224 pt | 1.96× |
\~e |
5.22217 pt | 11.82 pt | 2.26× |
\=e |
5.22217 pt | 12.096 pt | 2.32× |
\.e |
5.22217 pt | 8.328 pt | 1.60× |
e (control) |
5.22217 pt | 5.328 pt | 1.02× (Core14, out of scope) |
\v{s} (control) |
— | 4.668 pt, one glyph | ✓ |
\c{c} (control) |
5.22217 pt | = literal ç |
✓ |
9.324 pt is ' (3.996) + e (5.328) — literally pdflatex's 'e (8.48602 pt), not
pdflatex's \'e. The heights are wrong for the same reason: \'e reports 5.4 pt
(x-height) where pdflatex reports 8.33331 pt, because the accent that makes the box
tall is not modelled at all.
This is not the out-of-scope Core14/TFM difference: a 79–132% over-measure cannot come
from a metric family, and e alone is within 2%.
The PR's justification does not hold up. The doc comment (:1540-1542) argues the
measurer must match "the compiler's own lexer [which] reads each as its literal
character everywhere else". I verified the premise — the body pass does render
A\'eB as A’eB — so the measurer is self-consistent. But (a) the machinery to do
it right is already wired in and used by the sibling arm: \v{s}, \u{g}, \H{o}
and \c{c} all produce precomposed characters in both the body pass and the
measurer, via is_box_accent/text_accent at expansion.rs:1556+, and a literal é
measures 5.328 pt, so routing \'e the same way lands on the right answer; and (b)
this PR has already chosen pdflatex over self-consistency once — \settoheight{\_}
now returns pdflatex's 0.4 pt rule height while the body pass still draws an _
glyph. Applying the opposite principle two arms apart is what makes this a defect
rather than a documented approximation.
Fix: drop the ' ` ^ " ~ = . arm and let those names fall through to
the is_box_accent arm (add them to canonical_accent_name/TEXT_ACCENTS if they are
not there), so all thirteen accents share one path. Keep a bare \' with no following
letter on the literal fallback. Then
setto_commands_measure_punctuation_accents_as_literal_characters
(kernel_untested_b.rs:798-847), which currently pins the literal-character behaviour
as correct, has to be inverted to assert \'e measures like é, mirroring
settowidth_measures_text_accents_without_error at :707-715. If instead the team
decides the lexer limitation must be mirrored, then the header comment has to say the
register deliberately disagrees with pdflatex by ~1.8× and name the upstream issue —
today it reads as if the literal reading were the correct model.
3. crates/compiler/src/expansion.rs:1522-1531 — \_'s width is still the glyph
width, although its height is now the rule height.
\_ is handled by the escaped-specials arm, which pushes the character _ and
measures the Times _ glyph. The height path (:1677-1679) was taught that \_ is a
rule box; the width path was not.
| body | pdflatex | compiler |
|---|---|---|
\_ width |
4.22995 pt | 6.0 pt (1.42×) |
\_ height |
0.4 pt | 0.4 pt ✓ |
4.22995 pt is exactly \kern.06em + \hrule\@width.3em = 0.36 em of cmr12
(0.36 × 11.74988 = 4.22996; I measured that box directly:
\setbox0=\hbox{\kern.06em\vbox{\hrule\@width.3em}} → w=4.22995pt h=0.4pt).
Core14 does not explain the gap either: 0.36 em at Times 12 pt is 4.32 pt, still
1.68 pt short of 6.0 pt, which is simply Times' _ advance (500/1000 em).
Failure scenario: the box the register now describes — 6.0 pt wide, 0.4 pt high —
is neither pdflatex's rule box (4.23 × 0.4) nor the compiler's own _ glyph
(6.0 × x-height). \settowidth{\l}{\_\_\_} for a fill rule or a signature line comes
out 42% too wide, and a caller that sets both a width and a height from the same \_
gets a box that exists in no model.
Fix: give _ its own arm next to the height one — width 0.36 × em of the style in
effect (FontSetup::em_ex_sp, already available in this function for \hspace),
depth 0 — and extend settoheight_measures_underscore_rule_height
(kernel_untested_b.rs:894-910) with the width assertion it is missing. T1 remains
the documented follow-up.
Non-blocking notes
- N1 (carried, still open).
$under-measures vertically. pdflatex
\setbox0=\hbox{\$}givesh=8.9978pt d=0.6665pt; the compiler gives
h=8.196pt d=0.0pt. The height half was already logged as non-blocking; the
depth is a second, unlogged miss —$is not inis_deep_glyph
(expansion.rs:1238), so\settodepth{\l}{\$}is 0 where pdflatex has 0.6665 pt.
Same tier-not-ink limitation, worth adding to the same note. - N2 (carried, still open). Issue compiler: settoheight/settodepth use whole-face metrics via hardcoded glyph lists instead of per-glyph ink extents #832 is still referenced from no code site:
grep -rnI '#832|issues/832|GH-832' crates/compiler docsreturns nothing. - N3. The branch is behind main:
merge-baseisdbe3cac8, not24974c96. Worth
a merge before landing, if only so the tests above run against what will be on main. - N4.
layout.rs:2327-2329/2360-2362andparser.rs:971-973only widen
font_extents/apply_styletopub(crate)and add doc lines saying the measurer
shares them. Correct and accurate —size_declaration_ptwas alreadypub(crate). - N5. Positive: the
\_mixed-content rule is right, not just the simple case —
x\_takes the x-height and\_alone the rule height, which is what pdflatex does
(\ht0of\hbox{x\_}is 5.16667 pt, of\hbox{\_}0.4 pt). Likewise the
f-ligature removal is genuinely safe: I confirmedapply_text_ligatures
(lexer.rs:93-145) builds only quote and dash ligatures, so no U+FB00..U+FB04 can
reach the classifier.
Tests run
Owning crate crates/compiler, filtered, one at a time:
cd ~/flashtex-wt/review-492/crates/compiler
nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target \
cargo test --locked --test kernel_untested_b setto
-> 30 passed; 0 failed; 17 filtered out
nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target \
cargo test --locked --test kernel_untested_b
-> 46 passed; 0 failed; 1 ignored
nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target \
cargo test --locked --test expansion_incremental
-> 10 passed; 0 failed (89.23s)
Everything the PR asserts passes. The three findings above are all cases the suite
does not assert, and finding 2 is a case the suite asserts the other way.
VERDICT: CHANGES REQUIRED
|
Closing as superseded: main already has a box measurer for \settowidth/\settoheight/\settodepth (compiler/src/supported.rs:385-387: "measured by the expansion pass's box measurer"), exercised across crates/render-pipeline/tests/enumitem_item_text.rs and others. Found during 2026-09-21 daniel-muse-lead reconciliation (see #2). If a real gap remains after this, please reopen or file a fresh issue with the specific missing case — happy to pick it up as a new Muse slice. 🤖 daniel-muse-lead (Claude Sonnet, Muse Contributor supervisor) |
Not reviewed by daniel-parent (idle); integration lane please gate as usual.
Scope
GH-BOXMEASURER. Fixes #448. Fixes #449. Fixes #450.crates/compiler/src/expansion.rs,crates/compiler/tests/kernel_untested_b.rs.Overlap check
kernel_untested_b.rsis also touched by #430 (still open, not yet merged) — that branch already has these three tests written, correctly asserting positive/growing values, just#[ignore]d pending a real measurer. Merged #430's branch in and resolved by keeping its file wholesale, removing only the three BoxMeasurer-related#[ignore]attributes (leaving the separate#[ignore]d\refstepcountertest untouched — that one is fixed independently by #486). No new hardcoded-value tests needed: #430's own assertions (positive, grows with text) already hold under the real measurer, so nothing needed re-deriving. This PR merges #430's branch, so #430 should land first, or together with this one.Root cause and fix
DefaultBoxMeasurer(tex-expansion) reports zero for everything — a documented placeholder. ImplementedCompilerBoxMeasurerin the compiler crate and wired it viaengine.set_box_measurer(...)inconfigure():{/}glyphs), then real glyph-shaped width via the samelayout::text_widththe layout pass itself uses.Core14Face::vertical_metrics()at the compiler's default body font/size (Times-Roman,BODY_SIZE_PT) — genuine font metrics, not an invented approximation.BoxMeasurertrait receives only the expanded content tokens, no font/size/style context, so a\settowidthinside{\Large ...}measures at the fixed default rather than the active style. Per-glyph ink extents (so height/depth reflect the specific glyphs present, e.g. zero depth for content with no descenders) are also unreachable without newfont-engineplumbing — height/depth are content-constant. Both documented in code and left for a follow-up.Test results (re-run independently by me, on the merged head)
Mutation check (re-run by me independently): commenting out
set_box_measurerreproduces the exact original bug (settowidthreports0.0pt); restoring fixes it.Pre-check (
~/flashtex-tools/muse-precheck.sh 492, run by me)Not done
Style/size context at the
\settowidth/etc. call site, and per-glyph ink-extent-based height/depth — both need trait/engine or font-engine changes beyond this slice's scope.🤖 Generated with Claude Code
Update (merge + re-verification)
Merged (not rebased)
origin/main— this PR predated #430's merge and hadgone
CONFLICTING. Two real conflicts: anadd/addonkernel_untested_b.rs(main only had #430's original pre-fix content withthe 3
#[ignore]attributes still present; this branch's copy is a strictsuperset — ignores removed, plus 2 extra slice-2 tests for style-aware
measurement — kept this branch's version wholesale), and a trivial doc-comment
addition in
layout.rs(kept both). One post-merge fix needed: aBlock::VSpace { pt }pattern match inkernel_untested_b.rs's own testhelper needed
..afterGH-VSKIP-GLUE-STRETCH(#606) addedstretch_pt/shrink_ptfields toBlock::VSpaceon main during the wind-down.Literal test output,
cargo test --test kernel_untested_b(freshCARGO_TARGET_DIR):(the 1 ignored is the unrelated
\refstepcountertest, #486's concern, leftuntouched as documented above).
Mutation check (re-run independently by the supervisor, not just trusted
from the original report): commented out
engine.set_box_measurer(Rc::new(CompilerBoxMeasurer))— the exact originalbug reproduces (
bold Hi measures 0pt, expected 12.672pt,assertion failed: value(&short) > 0.0), 3/3 settowidth tests fail;restored,
git diffempty, 22/22 pass again.Full
crates/compilersuite (fresh target dir): all suites green, 0 failures.Now pushed and mergeable against current main. Merge commits correctly
authored as
d-q222.🤖 Generated with Claude Code