Apply the insertion count multiplier to page space

This commit is contained in:
gloamxun committed 2026-10-23 01:51:19 +08:00
1 parent 169119a48d
commit fb33ac6327
4 files changed
+153 -20

No files matched your search

+6 -3
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`). 313 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 315 workspace tests are green and no oracle
fixture is ignored.
Known gaps, in dependency order:
@@ -67,7 +67,8 @@ Known gaps, in dependency order:
`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
3. `\insert` classes model `\count`/`\dimen`/`\skip` but are not TeX
registers addressed by number, and there is still no interpreted output
routine;
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`),
@@ -229,7 +230,9 @@ Scope:
`\pageshrink`, `\pagedepth`;
- marks: `\mark`, `\botmark`, `\firstmark`, `\topmark`, `\marks`;
- insertions: `\insert` with `\count`, `\dimen`, `\skip` per class, split
insertions, held-over material, `\footins` defaults;
insertions, held-over material, `\footins` defaults (the three registers are
now modelled by `InsertionClass::multiplier`, `max_height` and `skip`; TeX's
register arithmetic and held-over bookkeeping remain);
- output: `\output` as an interpreted token list, `\box255`, `\shipout`,
`\outputpenalty`, `\deadcycles`, page display list assembly;
- floats: TeX-compatible policy module used by the default output routine
+6 -1
View File
@@ -208,6 +208,11 @@ oracle fixture is ignored.
`Document::insertion_skip` models TeX's `\skip\footins` and is reserved once
before the first insertion class on a page; it defaults to zero, and
`InsertionClass::skip` overrides it for a single insertion class.
`InsertionClass::multiplier` models `\count<number>` in thousandths: the page
space a class reserves is `height * multiplier / 1000`, so 2000 makes a 30pt
insertion cost 60pt of page height. `max_height` is the `\dimen<number>`
absolute cap. Full layout, incremental replay and the item-boundary splitter
all use the same reserved height.
Insertions taller than a page are split at item boundaries across pages.
- Page breaking handles vertical boxes/glue, `Document::top_skip` and forced
vertical penalties (`penalty <= -10000`); positive penalties are recorded
@@ -307,7 +312,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 202 unit tests plus six route-D integration tests and eight oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 313 tests (202 route-D unit, 6 route-D integration, 8 oracle, 71 v1 integration, 19 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
The crate currently has 204 unit tests plus six route-D integration tests and eight oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 315 tests (204 route-D unit, 6 route-D integration, 8 oracle, 71 v1 integration, 19 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
### M0 incremental demo