Skip to content

vendor: re-pin compiler past #265 so \| stops rendering as two \mid glyphs - #274

Merged
GoKubar merged 1 commit into
mainfrom
integ/vendor-repin-vert
Sep 14, 2026
Merged

GoKubar merged 1 commit into
mainfrom
integ/vendor-repin-vert

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

#265 fixed the compiler; it was inert in every rendered document until this. The Mac worker and the CLI are flashtex-render, which links vendor/compiler.

vendor/compiler → 2495ebf5.

Verified reaching the display list

Measured on glyph identity and advance (font metrics / the TeX box):

source before after
| two U+2223 one U+2016, adv 4.9813bp
\lVert x\rVert four U+2223 two U+2016
\big|, \Bigg| cmex "0C cmex "0D, adv 5.5348bp = 5.5556pt
\mid U+2223 U+2223, adv 2.7674bp (still distinct)

5.5556pt is exactly the "0D figure pdfTeX uses, against the "0C 3.33pt the crate was drawing.

On how this was measured

Nothing here comes from hit_rect. A math cluster's hit_rect takes its width from the laid-out TeX box but its height from the painted outline's ink, so it cannot be read as "the delimiter's box" — that mismatch has already produced two false defect reports against these same delimiters. Glyph identity and advance are unaffected by it, which is why the table above uses only those.

Also carried

The pin was five compiler commits behind, so this also brings #235 (a verbatim tab is one space, not an 8-column stop), #254's docs sweep, and the coverage-caveat generator fix into the pipeline.

Gates

Zero font-failure diagnostics (font_unavailable, required_metrics_unavailable, ec_metrics_unavailable, font_outline_substituted, tfm_missing, math_font_unavailable) — not zero diagnostics of any kind.

gate control (main 2495ebf5) after re-pin
render-pipeline --release --locked --no-fail-fast 213 passed, 0 failed 213 passed, 0 failed
render-pipeline failing SET empty empty (identical)
amsmath corpus 59/59 within 0.5 bp 59/59
amssymb corpus 38/39 38/39
HW1 / HW2 3 pages, 0 errors, 0 overfull same
real-world corpus (22 fixtures) status/pages/full diagnostic sets identical to control

Implementation-Agent: Claude Opus 5 (integration lane, linux-primary / NixOS)

…lyphs

`vendor/compiler` -> `2495ebf5`. The Mac worker and the CLI are
`flashtex-render`, which links this mirror, so #265 was inert until now: the
compiler was fixed and every rendered document still drew the wrong glyph.

**#265** `\|`/`\Vert`/`\lVert`/`\rVert` are U+2016 DOUBLE VERTICAL LINE, not
two U+2223 `\mid`s. Verified reaching the display list, measuring the glyph
identity and the **advance** (font metrics / the TeX box):

| source | before | after |
|---|---|---|
| `\|` | two U+2223 | one U+2016, adv 4.9813bp |
| `\lVert x\rVert` | four U+2223 | two U+2016 |
| `\big\|`, `\Bigg\|` | cmex `"0C` | cmex `"0D`, adv 5.5348bp = **5.5556pt** |
| `\mid` | U+2223 | U+2223, adv 2.7674bp (still distinct) |

5.5556pt is exactly the `"0D` figure pdfTeX uses, against the `"0C` 3.33pt
the crate was drawing.

**Deliberately not measured from `hit_rect`.** A math cluster's `hit_rect`
takes its width from the laid-out TeX box but its height from the painted
outline's ink, so it cannot be read as "the delimiter's box" -- that mismatch
has already produced two false defect reports against these same delimiters.
Everything above is glyph identity and advance, neither of which is affected.

The pin was five compiler commits behind, so the bump also carries #235
(a verbatim tab is one space, not an 8-column stop), #254's docs sweep and
the coverage-caveat generator fix.

Gates, NixOS linux-primary, bundled apps/mac/Fonts, FLASHTEX_TFM_DIRS =
public/lm:jknappen/ec:public/amsfonts/symbols. Zero **font-failure**
diagnostics (`font_unavailable`, `required_metrics_unavailable`,
`ec_metrics_unavailable`, `font_outline_substituted`, `tfm_missing`,
`math_font_unavailable`) -- not zero diagnostics of any kind:

| gate | control (main 2495ebf) | after re-pin |
|---|---|---|
| render-pipeline --release --locked --no-fail-fast | 213 passed, 0 failed | 213 passed, 0 failed |
| render-pipeline failing SET | empty | empty (identical) |
| amsmath corpus | 59/59 within 0.5 bp | 59/59 |
| amssymb corpus | 38/39 | 38/39 |
| HW1 / HW2 | 3 pages, 0 errors, 0 overfull | same |
| real-world corpus (22 fixtures) | status/pages/diagnostic sets | identical to control |

Implementation-Agent: Claude Opus 5 (integration lane, linux-primary / NixOS)
Commit-Executor: Claude Opus 5 via Claude Code (direct-agent Git execution
under the observed-Cursor-limit user override)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar merged commit 5e6c65b into main Sep 14, 2026
16 of 19 checks passed
GoKubar added a commit that referenced this pull request Sep 14, 2026
…wn field

A math cluster's `hit_rect` took its width from the laid-out TeX box and its
height from the painted outline's ink (`face.bounds(gid).y_max/y_min`). Text
clusters and stacked extensible delimiters already reported the box, so the
producer answered differently on three paths -- and nothing anywhere said
which of the two a cluster rectangle is. Not the schema (which carries one
`description` in the whole file, at the top level), not `docs/contracts/`,
not a doc comment.

Three lanes read a delimiter's height out of it, got the ink, and reported
engine defects against boxes that were exact (#265, #266 and their #2
comment). Against pdfTeX `\showbox`, 10 pt `article`:

| | pdfTeX box | before (ink) | after |
|---|---|---|---|
| `\Bigg(` | 30.00029 | 29.90000 | 30.00029 |
| `\Bigg[` | 30.00029 | 30.00000 | 30.00029 |
| `\bigg(` | 24.00022 | -- | 24.00022 |
| `\Big(`  | 18.00017 | -- | 18.00017 |
| `\big(`  | 12.00011 | -- | 12.00011 |
| cmmi10 `a` | 4.30554 | 4.53000 | 4.30554 |

`[` and `\{` measured "exact" in the same runs only because their flat
outlines fill their boxes to 0.0003 pt; `(`'s round ends stop 0.1 pt short,
which is the whole "the paren chain specifically is 0.33% short" report. The
other half -- "`\left|`/`\Bigg|` never grow" -- was one cmex extension
piece's 12.02 pt of ink inside its correct 6.00006 pt box, because the
OpenType bar is drawn to be overlapped.

**The representation, not a patched number.** `Cluster::hit_rect` named a
purpose; it is now `box_rect`, which names the measurement, and the painted
outline travels beside it as `ink_rect: Option<Rect>`. The wrong reading is
structurally unavailable rather than documented against:

- the field that was ambiguous no longer exists, and ink has only one place
  to live -- an `Option`, so there is no box-shaped value to mistake for it;
- the math path reads `boxes[gi]` from math-layout's own box tree, indexed
  rather than `get(..).unwrap_or(ink)`, so no silent fallback restores the
  old answer;
- the same conflation in the *width* is gone: one `adv` fed both the painted
  glyph's advance and the cluster's width, so an `\overbrace` piece reported
  its 10.02 pt painted advance as the width of a 4.50005 pt TeX box. Now
  `paint_adv` goes to `Glyph::advance_x` and `g.width` to `box_rect`;
- `Rect` says in its own doc that it carries no unit of meaning and the
  field holding it decides.

The one path still deriving a height from ink is the OpenType text fallback
(`shape::shape_otf`, when a font's TFM metrics are unresolvable): there is no
TeX box there to report, and `box_rect`'s doc now says so instead of leaving
it to be discovered.

**Consumers, mapped by reading every use site.** Hit testing
(`GlyphRunRenderer.swift:550`, whose own comment is "Nothing is measured on
the consumer side"), the caret highlight and its whole-cluster fallback
(`PreviewV2View.swift:1213`/`:1215`, filled beside a caret bar drawn from
`caret.top`/`caret.height`) and the scroll target
(`CaretFollow.swift:322`, whose tests assert `height > 0`) all want the box:
ink makes a space unhittable -- `RenderingV2.swift:717` permits `height == 0`
and `rendering-core/src/hit_test.rs:218` then drops the rect -- and a `.` a
one-point-tall target. It is also v1/v2 parity: the v1 pane already
hit-tests on CoreText `ascent + descent`. Only `formulaBox`
(`MathCaretHighlight.swift:66`) and the hover crop
(`MathHoverPreview.swift:54`, which pads by 4 pt) want ink, and they get
`ink_rect`. No consumer reads a cluster height as a measurement.

**Wire.** The default shape is unchanged: `hit_rects` keeps its name, shape
and required status, and only its math values move. `$defs.rect` and
`$defs.cluster.hit_rects` gain the definition that was never written down;
`ink_rect` is an optional property behind
`protocol/proposals/display-list-v2-ink-rect.md`, capability
`display-list-v2-ink-rect`, producer switch `display::Wire { ink_rects }`,
off by default -- so `additionalProperties: false`, rendering-core's
`deny_unknown_fields` and `scripts/check_rendering_v2.py` keep passing
untouched. It is refused next to `display-list-v2-delta`: `dl2-canon-1` does
not cover `ink_rect`, so a reused page could keep a stale one; that needs
`dl2-canon-2`. `rendering-abi.md` gains a row for each.

**Vendor.** No vendor change. The height and depth the painter needs are
recovered by `typeset::math_glyph_boxes`, a pre-order walk of the same public
`MathBox` tree `ml::positioned_runs` flattens, pinned glyph-for-glyph by
`math_glyph_boxes_line_up_with_the_flattened_run`. The fix is also made at
its source -- `crates/math-layout`'s `PositionedGlyph` now carries `height`
and `depth` beside `width` -- so the next `vendor/math-layout` re-pin retires
the walk.

Gates, NixOS linux-primary, bundled apps/mac/Fonts, `CARGO_BUILD_JOBS=4`,
zero **font-failure** diagnostics (`font_unavailable`,
`required_metrics_unavailable`, `ec_metrics_unavailable`, `tfm_missing`,
`math_font_unavailable`, `math_metrics_opentype`) -- not zero diagnostics of
any kind. Each against a control build of the same base, 5e6c65b
(re-measured after #274 re-pinned vendor/compiler under this branch; the
same numbers held at the original base 8a5ac44).

| gate | control | this change |
|---|---|---|
| amsmath oracle | 59/59 within 0.5 bp | 59/59 |
| render-pipeline | 213 passed, 0 failed, 1 ignored | 219 passed, 0 failed, 1 ignored |
| render-pipeline failing SET | empty | empty (identical) |
| math-layout | 66 passed, 0 failed | 66 passed, 0 failed |
| fixtures/real-world (22) | pages + per-code diagnostics | identical |
| HW1 / HW2 | 3 pages, 0 overfull, 0 errors | unchanged |

Both builds rendered all 22 fixtures and the whole `display_list` envelope
was compared: 5 are byte-identical, and the other 17 differ in
`cluster.hit_rects` and `cluster.carets` and in nothing else -- not one glyph
origin, advance, rule, font resource, page dimension, item count or
diagnostic. Of the 4,494 clusters whose rectangle moved, 0 changed `x` or
`width`; every difference is vertical, which is the ink-to-box correction.

`apps/mac` is not in this lane and is untouched; two of its assertions read
real-producer math geometry and will move. Flagged there on #2, with
`ink_rect` as the field `formulaBox` and the hover crop should adopt.

Implementation-Agent: Claude Opus 5 (engine lane, linux-primary / NixOS)
Commit-Executor: Claude Opus 5 via Claude Code (direct-agent Git execution
under the observed-Cursor-limit user override)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 14, 2026
`crates/render-pipeline` builds against `vendor/compiler`, not `../compiler`,
so the longtable/multirow/booktabs/colortbl types #250 added to
`crates/compiler/src/tabular.rs` are invisible to the pipeline until the
mirror is re-exported. This is the re-pin #250, #251 and #253 each say is
"deliberately not in any of these PRs (vendor is the integration lane's)";
both pipeline halves were measured against exactly this re-pin, locally.

It rides with #251 rather than landing as its own PR (as #274's re-pin did)
because it is not standalone-safe in either direction, verified on this tree
against main 5baa9e6:

  - re-pin without #251: `cargo build --release` in crates/render-pipeline
    fails, `error[E0027]: pattern does not mention fields kern_left,
    kern_right` -- #250 grew `Entry::CMidRule` and `table.rs::from_compiler`
    matches `ct::Entry` exhaustively with no wildcard arm;
  - #251 without the re-pin: the same build fails on the types it is written
    against (`ct::Longtable`, `ct::Multirow`, `ct::ColorFill`,
    `ct::Entry::SpecialRule`/`Section`/`PageBreak`/...), which is what
    #251's own `rust render-pipeline` and `rust flashtex-cli` CI jobs show.

Either half alone leaves main red, so they land in one merge.

`git archive 5baa9e6 crates/compiler`, byte-identical to the real crate
apart from `PIN` (verified by re-archiving the previous pin 2495ebf and
diffing against the committed mirror: only `PIN` differed).

Implementation-Agent: integration lane (linux-primary, NixOS)
Commit-Executor: Claude Opus 5 via Claude Code (direct-agent Git under the
  observed-Cursor-limit user override)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar deleted the integ/vendor-repin-vert branch September 16, 2026 04:17
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