Audit the G1 milestones and refresh the plan status
This commit is contained in:
1 parent
a93200cbfb
commit
f980ed7f56
2 files changed
+69
-64
No files matched your search
+19
-45
@@ -51,55 +51,29 @@ route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
|
||||
PDF opt-in with `?engine=route-d`). 476 workspace tests are green and no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Known gaps, in dependency order:
|
||||
Status after G1 (P0-P2): the paragraph model reproduces TeX's passes,
|
||||
demerits and paragraph registers, the paged builder implements the page
|
||||
builder (glue setting, inserts, marks, floats, paper size and page registers),
|
||||
and the interpreted `\output` routine runs page by page with conditionals,
|
||||
arithmetic, mark writes, register assignments and page retargeting. The audit
|
||||
table in [`TEX_CORE.md`](TEX_CORE.md) lists the evidence per milestone.
|
||||
|
||||
1. paragraph breaking reproduces TeX's passes and demerits (including
|
||||
`\adjdemerits`, `\doublehyphendemerits`, `\finalhyphendemerits`,
|
||||
source-level `\hyphenation{...}` exceptions and `\parshape` measures,
|
||||
`\parfillskip`, `\lineskip`, `\lineskiplimit`, `\topskip`, `\maxdepth`,
|
||||
`\splittopskip`, the demerit registers and `\sfcode`,
|
||||
`\hyphenpenalty`, `\exhyphenpenalty`, `\hyphenation` exceptions,
|
||||
`\hangindent`/`\hangafter`/`\parshape` line geometry, `\parfillskip`
|
||||
with or without `fil`, default `\sfcode` sentence spacing,
|
||||
`\looseness`, and `\baselineskip`/`\lineskip`/`\parskip` interline
|
||||
glue), custom `\sfcode` overrides, explicit `\spaceskip`/`\xspaceskip`,
|
||||
stretch and shrink on the inter-paragraph `\parskip` glue,
|
||||
`\raggedright` (infinite `\rightskip` fil), explicit
|
||||
`\hfil`/`\hfill` glue orders, and `\prevgraf` visibility in the output
|
||||
routine;
|
||||
2. the scrolling builder remains the non-paged fallback with fraction float
|
||||
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
|
||||
box/glue/penalty/mark/float/insertion units, with paragraphs expanded to
|
||||
one node per line so pages break inside them; route-D previews and PDFs
|
||||
use the paged builder when the document is expressible, insertion classes
|
||||
(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 flow inline, so every
|
||||
float placement goes through the paged builder, and the interpreted
|
||||
`\output` subset handles `\shipout`, `\ifdim` and `\ifnum` over page
|
||||
registers such as `\pageno`, `\outputpenalty`, `\deadcycles`, `\vbadness` and
|
||||
`\insertpenalties`;
|
||||
3. `\insert` classes are TeX registers addressed by number (`\count<n>`,
|
||||
`\dimen<n>`, `\skip<n>`, with `\count0` aliasing `\pageno`) and the
|
||||
interpreted output routine can assign `\pageno`, `\deadcycles`,
|
||||
`\outputpenalty` and those insertion registers, `\ht255`/`\dp255`/`\wd255` expose the page
|
||||
box height and depth, and the assigned values carry
|
||||
over to later pages (TeX output registers are global); an assigned `\vsize`
|
||||
changes the goal of every page the routine has not seen yet (the remaining
|
||||
fragments are rebuilt from the next node index; insertion material is fine
|
||||
because class limits apply at assembly time), though a document that defers
|
||||
bottom floats keeps its initial goal; the paged builder runs the routine
|
||||
page by page, so `\dimen<n>` and `\count<n>` assignments change the insertion limits and reservations of later pages; the configured `\skip<n>` reserves space above its class once per page, and an output-routine `\skip<n>` assignment rebuilds the remaining pages with the new reservation, so later insertion material pays the assigned skip; `\mark{...}` and classed `\marks<n>{...}` writes inside the routine are carried to the following page's marks; `\box255` content is not inspectable and the full `\output` machinery is still missing;
|
||||
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`),
|
||||
Remaining gaps:
|
||||
|
||||
1. `\halign` handles spans/omit/templates but not the full TeX column algorithm;
|
||||
2. math is a compact subset without the CM math fonts (`cmmi`, `cmsy`, `cmex`),
|
||||
display-math line breaking or `\mathchoice`-level styling;
|
||||
6. text fonts are Liberation, not Computer Modern; Type1 fonts are not embeddable
|
||||
3. text fonts are Liberation, not Computer Modern; Type1 fonts are not embeddable
|
||||
yet, so pixel comparison against pdfLaTeX is impossible;
|
||||
7. class files (`article.cls`, `sn-jnl.cls`) are mapped semantically, never
|
||||
4. class files (`article.cls`, `sn-jnl.cls`) are mapped semantically, never
|
||||
executed;
|
||||
8. the service integration is opt-in and maps only a small LaTeX subset.
|
||||
5. the service integration is opt-in and maps only a small LaTeX subset;
|
||||
6. the content of `\box255` is not inspectable, `\topmarks`/`\firstmarks`/
|
||||
`\botmarks` are not readable by the routine, an assigned `\vsize` cannot
|
||||
retarget a document that defers bottom floats, paged replay falls back to a
|
||||
full rebuild with an interpreted `\output` or insertions, and a
|
||||
narrow-measure `\tolerance=10000` break can differ from TeX's demerit
|
||||
optimum.
|
||||
|
||||
Host tooling available: `pdflatex`, `xelatex`, `lualatex`, `pdftoppm`,
|
||||
`pdftotext`, `kpsewhich`, `fonttools`/`ttx`.
|
||||
|
||||
+50
-19
@@ -387,6 +387,30 @@ cargo run -p texrra-tex-core --example incremental_article
|
||||
cargo run -p texrra-tex-core --example pdf_display > /tmp/route-d.pdf
|
||||
```
|
||||
|
||||
|
||||
### G1 audit (P0-P2)
|
||||
|
||||
The `G1` scope of [`ROUTE_D_PLAN.md`](ROUTE_D_PLAN.md) is implemented and
|
||||
covered by the suite:
|
||||
|
||||
| Milestone | Evidence |
|
||||
| --- | --- |
|
||||
| P0 oracle harness | `crates/texrra-tex-core/tests/oracle.rs` runs pdfLaTeX/pdftoppm/pdftotext comparisons, skips when a tool is missing, and covers 35 paragraph/page fixtures: measure matrix 90-240pt, `\tolerance`/`\pretolerance`/`\emergencystretch`, `\hangindent`/`\parshape`, `\parfillskip`, glues, sentence spacing, narrow-measure pretolerance, page breaks, floats, insertions and `\newpage`. |
|
||||
| P1 paragraphs | TeX passes and demerits (`\pretolerance`/`\tolerance`, adjacent fitness 0-3, line penalty, `\adjdemerits`, double/final hyphen demerits, `\emergencystretch`), hyphenation from flat/exception data, `\hangindent`/`\hangafter`/`\parshape`, `\looseness`, `\leftskip`/`\rightskip`/`\parfillskip` with `fil`, `\baselineskip`/`\lineskip`/`\lineskiplimit`, `\parskip` with plus/minus, `\spaceskip`/`\xspaceskip`, `\sfcode`/`\frenchspacing`, `\tolerance`-family registers, interword `fil`/`fill` glue, italic correction and TFM kerning/ligatures. |
|
||||
| P2 page builder | TeX candidate-break cost and legal glue breaks, glue setting (`\raggedbottom`/`\flushbottom`, glue orders), `\vsize`/`\voffset`/`\topskip`/`\maxdepth`, paper size, marks (classed, carried to the next page), insertion classes (`\count<n>`/`\dimen<n>`/`\skip<n>`, splitting, held-over, dedicated held pages), and interpreted `\output` with `\shipout\box255`, conditionals, arithmetic, mark writes, register reads/assignments and page retargeting. Floats keep their top/bottom/in-text/float-page policies. |
|
||||
|
||||
Residual approximations, documented rather than special-cased:
|
||||
|
||||
- the content of `\box255` is not inspectable (its width/height/depth are);
|
||||
- `\topmarks`/`\firstmarks`/`\botmarks` are not readable by the routine;
|
||||
- an assigned `\vsize` cannot retarget a document that defers bottom floats;
|
||||
- paged replay falls back to a full rebuild when an interpreted `\output`
|
||||
routine or insertions are present;
|
||||
- a narrow-measure `\tolerance=10000` break can differ from TeX's demerit
|
||||
optimum because the model uses the simplified badness table;
|
||||
- NFSS family switching and multi-face Computer Modern outlines are not
|
||||
implemented (route-D embeds Liberation faces).
|
||||
|
||||
### Open milestones
|
||||
|
||||
The staged program that closes these milestones is described in
|
||||
@@ -402,26 +426,33 @@ deliberately open rather than approximated:
|
||||
interline glue, the default `\sfcode`/`\frenchspacing` sentence spacing,
|
||||
explicit `\spaceskip`/`\xspaceskip`, stretch and shrink on the
|
||||
inter-paragraph `\parskip` glue, and `\raggedright` (infinite `\rightskip` fil) are modelled.
|
||||
- **M2**: `Engine::layout` keeps the scrolling builder as the non-paged
|
||||
fallback, while route-D previews and PDFs run `Engine::layout_paged`;
|
||||
`page::PageBuilder` implements TeX's candidate-breakpoint cost (badness + penalty, glue
|
||||
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
|
||||
is clamped, as in TeX); glue of the highest TeX order with stretch (`\vfil`
|
||||
and above) absorbs the whole setting, so a page that stops short of the goal
|
||||
is free when fill glue is present; paged edits replay from the edited page, insertions
|
||||
and an interpreted `\output` keep the full-rebuild fallback; paper margins
|
||||
remain open, and
|
||||
the `\output` interpreter only covers the shipout/ifdim/ifnum/ifodd/ifcase subset (explicit
|
||||
`\hoffset`/`\voffset` offsets are applied by both the PDF writer and the
|
||||
preview display list).
|
||||
- **M2**: `Engine::layout` keeps the scrolling builder as the
|
||||
non-paged fallback, while route-D previews and PDFs run `Engine::layout_paged`.
|
||||
`page::PageBuilder` implements TeX's candidate-breakpoint cost (badness +
|
||||
penalty, glue stretch/shrink, `\topskip`, `\maxdepth`), legal glue breaks
|
||||
(glue after glue is not a breakpoint and the glue at a break is discarded),
|
||||
`\raggedbottom`/`\flushbottom` and the `\vfil`/`\vfill`/`\vfilll` orders,
|
||||
per-page `\vsize` and `\maxdepth`, top/bottom/in-text floats with
|
||||
`\floatsep`/`\textfloatsep`/`\intextsep` and the fraction/count limits,
|
||||
and insertion classes with `\count<n>`, `\dimen<n>` and `\skip<n>`,
|
||||
splitting and held-over material. `Document::output_routine` is interpreted
|
||||
after every paged page for `\shipout\box255`, `\relax`, `\message`,
|
||||
`\mark`/`\marks<n>`, `\ifdim`, `\ifnum`, `\ifodd`, `\ifcase`,
|
||||
`\advance`/`\multiply`/`\divide` and register assignments; the routine
|
||||
reads `\pagegoal`, `\pagetotal`, `\pagedepth`, the page stretch registers,
|
||||
`\vbadness`, `\insertpenalties`, `\ht255`/`\dp255`/`\wd255`, `\hsize`,
|
||||
`\vsize`, `\topskip`, `\maxdepth`, `\outputpenalty`, `\pageno`,
|
||||
`\deadcycles`, `\maxdeadcycles`, `\prevgraf` and the insertion registers,
|
||||
and its `\vsize`, `\dimen<n>`, `\count<n>` and `\skip<n>` assignments
|
||||
rebuild the pages it has not seen yet. Explicit `\hoffset`/`\voffset`
|
||||
offsets are applied by the PDF writer and the preview display list.
|
||||
- **M5**: `cmr10.tfm` is parsed at runtime with widths, glyph heights/depths and kern pairs. only used text faces embed Liberation Serif/Mono as Type0/Identity-H; each face is subset to the glyphs actually used (composite components included, glyph IDs retained); FontFile2 and ToUnicode streams use Flate compression; the ToUnicode CMap follows the used characters; ff/fi/fl/ffi/ffl ligatures come from TFM, and CMR10 italic corrections are applied at line ends; full NFSS family switching is not implemented.
|
||||
- **M6**: `\output`, `\insert`, mark/float output policies, class-file execution and
|
||||
math limit policies are only partially modeled; `OutputRoutine::wants_break` can force a page break between units, and insertion material is stacked by class from the page bottom; `Document::output_routine` is interpreted per page by `output::OutputProgram` for the shipout/ifdim/ifnum/ifodd/ifcase subset (with `\pageno`, `\outputpenalty`, `\deadcycles`), while `OutputRoutine` remains the Rust hook.
|
||||
- **M6**: class-file execution and the parser side of `\output`/`\insert`
|
||||
are still semantic: the source parser maps LaTeX constructs onto the
|
||||
document model and `Document::output_routine` is the interpreted program.
|
||||
`OutputRoutine::wants_break` remains a Rust hook for forcing a page break
|
||||
between units, insertion material is stacked by class from the page bottom,
|
||||
and the page box (`\box255`) exposes width/height/depth but not its content.
|
||||
- Page hashes cover rendered items/insertions/marks/floats, not source-dependency
|
||||
metadata, so replaying an earlier page cannot change its hash merely by
|
||||
re-attaching source hashes.
|
||||
|
||||
Reference in new issue
Block a user