Place bottom floats through the paged builder
This commit is contained in:
1 parent
7b9d543e49
commit
14ca3b91d9
5 files changed
+198
-34
No files matched your search
+10
-9
@@ -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`). 370 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 375 workspace tests are green and no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Known gaps, in dependency order:
|
||||
@@ -67,9 +67,10 @@ yet generic `fil`/`fill` glue
|
||||
implements the candidate-breakpoint cost model (badness + penalty, glue
|
||||
setting, `\topskip`, `\maxdepth`) and `Engine::layout_paged` runs it for
|
||||
documents made of box/glue/penalty/mark units, insertion classes
|
||||
(per-class limits with held-over material) and top floats (with
|
||||
`\textfloatsep` reserved above the body); bottom/in-text floats and
|
||||
incremental checkpoint replay still use the scrolling builder, and the interpreted
|
||||
(per-class limits with held-over material) and top and bottom floats
|
||||
(`\textfloatsep` above the body, `\floatsep` between stacked bottom
|
||||
floats, `\bottomfraction` cap); in-text floats still use the scrolling
|
||||
builder, and the interpreted
|
||||
`\output` subset handles `\shipout`, `\ifdim` and `\ifnum` over page
|
||||
registers such as `\pageno`, `\outputpenalty` and `\deadcycles`;
|
||||
3. `\insert` classes model `\count`/`\dimen`/`\skip` but are not TeX
|
||||
@@ -275,13 +276,13 @@ with `pdftotext -bbox`. `Document::paper_width`/`paper_height`
|
||||
page box, and the endpoints read leading
|
||||
`\hoffset`/`\voffset`/`\paperwidth`/`\paperheight` dimension assignments from
|
||||
the source. Insertion classes are placed by the
|
||||
paged builder with their limits and held-over material, and top floats are
|
||||
placed at the head of a fragment with `\textfloatsep` reserved above the body;
|
||||
bottom/in-text floats still fall back to the scrolling builder, which stays
|
||||
the default until it has a paged equivalent. Paged layouts also record the
|
||||
paged builder with their limits and held-over material, top floats are placed
|
||||
at the head of a fragment with `\textfloatsep` reserved above the body, and
|
||||
bottom floats sit at the page bottom with `\floatsep` between them and a
|
||||
`\bottomfraction` cap; in-text floats still fall back to the scrolling builder. Paged layouts also record the
|
||||
node index starting each page, so `Engine::edit` reuses the sealed prefix and
|
||||
rebuilds only the pages from the edited unit onward; insertions and interpreted
|
||||
`\output` keep the full-rebuild fallback. Next: port bottom/in-text floats and
|
||||
`\output` keep the full-rebuild fallback. Next: port in-text floats and
|
||||
paper margins, then extend the `\output` interpreter past the
|
||||
shipout/ifdim/ifnum/ifodd/ifcase subset.
|
||||
|
||||
|
||||
+10
-7
@@ -116,7 +116,7 @@ and justification.
|
||||
| --- | --- | --- |
|
||||
| M0 | vertical list, page builder, checkpoint, page hash, edit demo | edit on page 2 rebuilds only page 2 |
|
||||
| M1 | TeX box/glue/penalty + paragraph builder (`\par`, `\hsize`, `\parindent`) | **partial**: item stream, CMR10 metrics, TeX Live en-US hyphenation, TeX demerits and tolerance passes, `\hangindent`/`\parshape`, `\parfillskip`, sentence spacing, `\spaceskip`/`\xspaceskip`, `\looseness`, `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfLaTeX oracle matrix 90-240pt plus register, geometry, `\sfcode` and vertical-glue fixtures; generic fil glue and `\prevgraf` next |
|
||||
| M2 | page builder + `\output`, `\vsize`, `\topskip`, footnotes, floats | **partial**: `\vsize` page goal, `\topskip`, forced penalties, `Insertion` reserve, running `Mark`s, `OutputRoutine` hook, top/bottom `Float` placement; `page::PageBuilder` scores candidate breakpoints with TeX page badness, glue setting, `\topskip`/`\maxdepth`, and `Engine::layout_paged` uses it for documents whose units are single vertical items, placing top floats and insertion classes on that path, while the scrolling builder remains the default for bottom/in-text floats; paged layouts replay edits from the edited unit's page and fall back to a full rebuild only when insertions or an interpreted `\output` are present; `\output` is interpreted for a `\shipout`/`\ifdim`/`\ifnum`/`\ifodd`/`\ifcase` subset; `\pageno`, `\outputpenalty` and `\deadcycles` are readable registers and `PageFragment::penalty` carries the break penalty |
|
||||
| M2 | page builder + `\output`, `\vsize`, `\topskip`, footnotes, floats | **partial**: `\vsize` page goal, `\topskip`, forced penalties, `Insertion` reserve, running `Mark`s, `OutputRoutine` hook, top/bottom `Float` placement; `page::PageBuilder` scores candidate breakpoints with TeX page badness, glue setting, `\topskip`/`\maxdepth`, and `Engine::layout_paged` uses it for documents whose units are single vertical items, placing top and bottom floats (with `\floatsep` and a `\bottomfraction` cap) and insertion classes on that path, while the scrolling builder remains the default for in-text floats; paged layouts replay edits from the edited unit's page and fall back to a full rebuild only when insertions or an interpreted `\output` are present; `\output` is interpreted for a `\shipout`/`\ifdim`/`\ifnum`/`\ifodd`/`\ifcase` subset; `\pageno`, `\outputpenalty` and `\deadcycles` are readable registers and `PageFragment::penalty` carries the break penalty |
|
||||
| M3 | `\halign`, `\omit`, `\span`, `\multispan`, booktabs/longtable | **partial**: source parsing, natural column widths, spans, rule rows, 10pt display-list painting and row-level page splitting; no booktabs/longtable parity yet |
|
||||
| M4 | math lists, scripts, fractions, radicals, accents, delimiters | **partial**: token parser, atom boxes with CMR10 metrics, delimiter scaling, accents and a display-list painter; no CMEX size variants or TeX math spacing classes yet |
|
||||
| M5 | NFSS/TFM metrics, CM/Latin Modern | same line/page breaks as reference |
|
||||
@@ -248,11 +248,14 @@ oracle fixture is ignored.
|
||||
consecutive paragraph units and is discarded when it would start a page,
|
||||
matching TeX's paragraph spacing in vertical lists. The routine cannot yet
|
||||
change page goals. The paged builder places top `Float` material at the top
|
||||
of a page, defers a late float to the next page, and route-D preview/PDF
|
||||
draw pages through `display_list_with_layout` so the body clears
|
||||
`\textfloatsep`; bottom floats reserve height on the current page and must satisfy
|
||||
`Document.text_fraction_percent` (default 50%); a page holding only floats
|
||||
is sealed once it leaves less than that fraction for text.
|
||||
of a page and bottom `Float` material at the page bottom: a late top float
|
||||
starts the next page, a bottom float that cannot fit the remaining body
|
||||
space is deferred, stacked bottom floats reserve `\floatsep`, and
|
||||
`\bottomfraction` caps the bottom float share. Route-D preview/PDF draw
|
||||
pages through `display_list_with_layout` so the body clears
|
||||
`\textfloatsep` / the bottom float area; the scrolling builder still
|
||||
reserves height for bottom floats against `Document.text_fraction_percent`
|
||||
(default 50%) and seals float-only pages.
|
||||
- No macro state, output routine, math, fonts or PDF output in the new core yet.
|
||||
- The v1 server and project API still use `src/rust_typeset` and are unchanged.
|
||||
|
||||
@@ -339,7 +342,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 247 unit tests plus seven route-D integration tests and sixteen oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 370 tests (247 route-D unit, 7 route-D integration, 16 oracle, 71 v1 integration, 22 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 252 unit tests plus seven route-D integration tests and sixteen oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 375 tests (252 route-D unit, 7 route-D integration, 16 oracle, 71 v1 integration, 22 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
|
||||
Reference in new issue
Block a user