Interpret the output routine shipout and ifdim subset

This commit is contained in:
gloamxun committed 2026-10-23 02:59:54 +08:00
1 parent 6cf8221ba7
commit 4bec90cf8c
5 files changed
+496 -20

No files matched your search

+11 -10
View File
@@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
PDF opt-in with `?engine=route-d`). 336 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 344 workspace tests are green and no oracle
fixture is ignored.
Known gaps, in dependency order:
@@ -68,11 +68,11 @@ yet generic `fil`/`fill` glue
setting, `\topskip`, `\maxdepth`) and `Engine::layout_paged` runs it for
documents made of box/glue/penalty/mark units and insertion classes
(per-class limits with held-over material), but floats and incremental
checkpoint replay still use the scrolling builder, and an interpreted
`\output` is absent;
checkpoint replay still use the scrolling builder, and the interpreted
`\output` subset handles `\shipout`/`\ifdim` only;
3. `\insert` classes model `\count`/`\dimen`/`\skip` but are not TeX
registers addressed by number, and there is still no interpreted output
routine;
registers addressed by number; the interpreted output routine covers page
shipping and `\ifdim` comparisons but not the full `\output` machinery;
4. `\halign` handles spans/omit/templates but not the full TeX column algorithm;
5. math is a compact subset without the CM math fonts (`cmmi`, `cmsy`, `cmex`),
display-math line breaking or `\mathchoice`-level styling;
@@ -242,8 +242,9 @@ Scope:
now modelled by `InsertionClass::multiplier`, `max_height` and `skip`, and
the fitting head stays on the anchor page with the tail held over; TeX's
register arithmetic remains);
- output: `\output` as an interpreted token list, `\box255`, `\shipout`,
`\outputpenalty`, `\deadcycles`, page display list assembly;
- output: `\output` as an interpreted token list (`\shipout\box255`, `\ifdim`
over page registers landed), `\outputpenalty`, `\deadcycles`, page display
list assembly;
- floats: TeX-compatible policy module used by the default output routine
(top/bottom fractions and counts already exist).
@@ -264,8 +265,8 @@ with `pdftotext -bbox`, and the PDF endpoint reads leading `\hoffset`/`\voffset`
dimension assignments from the source. Insertion classes are placed by the
paged builder with their limits and held-over material; floats and checkpoint
replay still fall back to the scrolling builder, which stays the default until
it has a paged equivalent. Next: port those paths, then paper margins and the interpreted
`\output`.
it has a paged equivalent. Next: port those paths and paper margins, then extend the `\output`
interpreter past the shipout/ifdim subset.
Acceptance: 10 page fixtures (article text, footnotes, floats, forced breaks);
page counts identical and first/last baselines within 1pt of pdfLaTeX.
@@ -408,7 +409,7 @@ Acceptance: corpus green or explicitly listed; CI documented.
| goal | phases | deliverable |
| --- | --- | --- |
| G1 (current) | P0, P1, P2 | TeX-exact paragraphs, vertical list, page builder, interpreted `\output` |
| G1 (current) | P0, P1, P2 | TeX-exact paragraphs, vertical list, page builder, interpreted `\output` (shipout/ifdim subset landed) |
| G2 | P3, P4 | tables and math at L2/L3 |
| G3 | P5 | Computer Modern fonts, NFSS, pixel parity for text/math |
| G4 | P6 | class execution (article, journal) |