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

+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