Break pages only at legal glue points

This commit is contained in:
gloamxun committed 2026-10-23 14:38:35 +08:00
1 parent 247cbf2b9e
commit 2b2ccd511c
4 files changed
+71 -9

No files matched your search

+4 -4
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`). 445 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 446 workspace tests are green and no oracle
fixture is ignored.
Known gaps, in dependency order:
@@ -301,9 +301,9 @@ interpreter past the shipout/ifdim/ifnum/ifodd/ifcase subset.
Acceptance: 10 page fixtures (article text, footnotes, floats, forced breaks);
page counts identical and first/last baselines within 1pt of pdfLaTeX.
Progress: four page fixtures are wired (single-line paragraphs, `\parskip=6pt`
spacing, multi-line paragraphs split across pages, and `\newpage` forced
breaks); each asserts the same
Progress: five page fixtures are wired (single-line paragraphs, `\parskip=6pt`
spacing, multi-line paragraphs split across pages, `\newpage` forced breaks,
and stretchy `\vskip` glue between paragraphs); each asserts the same
page count and the same per-page text as pdfLaTeX.
### P3 — `\halign` / `\valign` (L2)
+6 -4
View File
@@ -355,7 +355,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`) supplies advances, kerns, ligatures, and italic correction for layout, while the display list and PDF select the matching Liberation face. `Engine::edit` preserves the face when reflowing an edited paragraph.
The crate currently has 296 unit tests plus seven route-D integration tests and twenty-eight oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 445 tests (296 route-D unit, 7 route-D integration, 28 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 12 binary units), with none ignored. v1 remains the live server path.
The crate currently has 296 unit tests plus seven route-D integration tests and twenty-nine oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 446 tests (296 route-D unit, 7 route-D integration, 29 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 12 binary units), with none ignored. v1 remains the live server path.
### M0 incremental demo
@@ -383,15 +383,17 @@ The staged program that closes these milestones is described in
Route D currently covers M0-M4/M6 as a working subset. The remaining milestones are
deliberately open rather than approximated:
- **M1**: generic `fil`/`fill` glue orders and
`\prevgraf` are still open; the tolerance, penalty and demerit registers,
- **M1**: the paragraph model covers generic `fil`/`fill` glue orders and
`\prevgraf`, plus the tolerance, penalty and demerit registers,
`\hyphenation` exceptions, `\hangindent`/`\parshape`, `\parfillskip` with
or without `fil`, `\looseness`, `\baselineskip`/`\lineskip`/`\parskip`
interline glue, the default `\sfcode`/`\frenchspacing` sentence spacing,
explicit `\spaceskip`/`\xspaceskip`, and `\raggedright` (infinite `\rightskip` fil) are modelled.
- **M2**: the scrolling builder still drives `Document`; `page::PageBuilder`
implements TeX's candidate-breakpoint cost (badness + penalty, glue
stretch/shrink, `\topskip`, `\maxdepth`) and `Engine::layout_paged` runs it
stretch/shrink, `\topskip`, `\maxdepth`); a break at glue is only legal
when it follows a non-discardable item, so glue after glue is not a
breakpoint and the glue at a break is discarded and `Engine::layout_paged` runs it
for simple documents; `PageBuilder::ragged_bottom` selects `\raggedbottom`
(the default) or `\flushbottom`, which stretches `VerticalItem::StretchGlue`
in proportion to its stretch so the page body reaches the goal (only shrink