Feed simple documents through the TeX page builder

This commit is contained in:
gloamxun committed 2026-10-23 01:45:45 +08:00
1 parent d4a9c6b4fd
commit 9599982b91
4 files changed
+195 -17

No files matched your search

+12 -8
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`). 301 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 311 workspace tests are green and no oracle
fixture is ignored.
Known gaps, in dependency order:
@@ -62,10 +62,11 @@ Known gaps, in dependency order:
glue), but not yet custom `\sfcode` overrides, generic `fil`/`fill` glue
orders or `\prevgraf`;
2. the page builder used by `Document` is still the scrolling builder with
fraction policies; `page::PageBuilder` now implements the candidate-breakpoint
cost model (badness + penalty, glue setting, `\topskip`, `\maxdepth`) with
unit tests, but it is not yet wired into `Document` and an interpreted
`\output` is absent;
fraction policies; `page::PageBuilder` implements the candidate-breakpoint
cost model (badness + penalty, glue setting, `\topskip`, `\maxdepth`) and
`Engine::layout_paged` runs it for documents made of single-item units, but
floats, insertions and incremental checkpoint replay still use the scrolling
builder, and an interpreted `\output` is absent;
3. `\insert` classes are data structures, not TeX registers and an output
routine;
4. `\halign` handles spans/omit/templates but not the full TeX column algorithm;
@@ -240,9 +241,12 @@ marks) and chooses each page at the cheapest feasible breakpoint, scoring
badness from the page goal and accumulated glue, adding the break penalty, and
applying `\topskip` to the first box and `\maxdepth` to the page depth. Seven
unit tests cover overfull avoidance, exact glue filling, forced penalties,
penalty-driven earlier breaks, `\topskip`, `\maxdepth` and marks. Wiring this
builder into `Document` and replacing the scrolling path is the next step,
followed by `\voffset`, insertion registers and the interpreted `\output`.
penalty-driven earlier breaks, `\topskip`, `\maxdepth` and marks.
`Engine::layout_paged` now feeds it every document whose units are single
vertical items and materialises the chosen fragments as hashed pages; floats,
insertions 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
`\voffset`, insertion registers and the interpreted `\output`.
Acceptance: 10 page fixtures (article text, footnotes, floats, forced breaks);
page counts identical and first/last baselines within 1pt of pdfLaTeX.