Honour explicit sfcode assignments

This commit is contained in:
gloamxun committed 2026-10-23 02:29:40 +08:00
1 parent b5ec36ae2a
commit 4acccaee86
7 files changed
+99 -18

No files matched your search

+3 -3
View File
@@ -59,7 +59,7 @@ Known gaps, in dependency order:
`\hangindent`/`\hangafter`/`\parshape` line geometry, `\parfillskip`
with or without `fil`, default `\sfcode` sentence spacing,
`\looseness`, and `\baselineskip`/`\lineskip`/`\parskip` interline
glue), but not yet custom `\sfcode` overrides, generic `fil`/`fill` glue
glue), custom `\sfcode` overrides, but not yet generic `fil`/`fill` glue
orders or `\prevgraf`;
2. the default builder is still the scrolling builder with fraction
policies, now with line-level paragraph splits; `page::PageBuilder`
@@ -215,8 +215,8 @@ not fit is split at line boundaries: the next fragment continues on the next
page without a `\parskip`, and a single unsplittable line may overflow at the
top of a page (see `Paragraph::split_at`).
Still open: generic `fil`/`fill` glue orders, custom `\sfcode` overrides,
`\prevgraf`, explicit `\vskip` classes (`\smallskip` and friends),
Still open: generic `fil`/`fill` glue orders, `\prevgraf`, explicit
`\vskip` classes (`\smallskip` and friends),
double/final hyphen demerit oracle fixtures, and more width fixtures.
### P2 — Vertical list, page builder, `\output` (L2)
+8 -6
View File
@@ -109,7 +109,7 @@ and justification.
| Milestone | Content | Acceptance |
| --- | --- | --- |
| 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, `\looseness`, `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfLaTeX oracle matrix 100-240pt plus register, geometry and vertical-glue fixtures; custom `\sfcode`, generic fil glue and `\prevgraf` next |
| 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, `\looseness`, `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfLaTeX oracle matrix 100-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, while the scrolling builder remains the default; interpreted `\output` next |
| 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 |
@@ -129,7 +129,9 @@ and justification.
line is justified. Sentence spacing follows TeX's default `\sfcode` values:
interword glue stretch is multiplied by the space factor, shrink is divided
by it, `\fontdimen7` is added from factor 2000, and `\frenchspacing`
disables the effect. `\looseness` shifts the paragraph by whole lines when
disables the effect. `ParagraphStyle::space_factor_codes` carries explicit
`\sfcode` assignments, which replace the built-in table for that character;
a zero code leaves the running factor unchanged, as in TeX. `\looseness` shifts the paragraph by whole lines when
the requested count lies between one and nine lines away from the natural
count (the adjustment is reverted when no feasible layout exists).
Interline glue follows TeX: each baseline advances by `\baselineskip` when
@@ -139,8 +141,8 @@ and justification.
boundaries (`Paragraph::split_at`): the fragment keeps its baseline grid on
the next page, `\parskip` is not charged inside the paragraph, and only a
single unsplittable line is allowed to overflow at the top of a page.
Remaining gaps are custom `\sfcode` overrides, generic `fil`/`fill` glue
orders outside `\parfillskip`, and `\prevgraf`.
Remaining gaps are generic `fil`/`fill` glue orders outside
`\parfillskip` and `\prevgraf`.
The pdfLaTeX oracle pins the 100-240pt measure matrix plus `\hangindent`,
`\parfillskip`, sentence-spacing and `\looseness` fixtures; all match and no
@@ -280,7 +282,7 @@ for a later overlaid slash.
| Milestone | State | Notes |
| --- | --- | --- |
| M0 checkpoint engine | done | page list, page hashes, snapshot/restore, edit replay |
| M1 horizontal/paragraphs | partial | boxes/glue/penalties, CMR10 metrics, TeX Live en-US hyphenation, TeX demerits and tolerance passes, `\hangindent`/`\parshape`, `\parfillskip`, sentence spacing (`\sfcode`/`\frenchspacing`), `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfTeX oracle matrix 100-240pt plus register, geometry and vertical-glue fixtures |
| M1 horizontal/paragraphs | partial | boxes/glue/penalties, CMR10 metrics, TeX Live en-US hyphenation, TeX demerits and tolerance passes, `\hangindent`/`\parshape`, `\parfillskip`, sentence spacing with default and custom `\sfcode`/`\frenchspacing`, `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfTeX oracle matrix 100-240pt plus register, geometry and vertical-glue fixtures |
| M2 vertical/page builder | partial | vsize, topskip, insertions, marks, Rust output hook, top/bottom floats, float-page/text fractions, rules, vskip, penalties; `page::PageBuilder` scores breakpoints with page badness and penalties and models `\topskip`/`\maxdepth`; `Engine::layout_paged` builds pages through it for single-item documents, while floats, insertions and incremental replay still use the scrolling path; interpreted `\output` absent |
| M3 halign | partial | natural columns, spans, omit, hline rows, templates, noalign skip, rules; no PDF painter |
| M4 math | partial | atoms, scripts, fractions, roots, delimiters, accents, operators, classes, braces, boxed, negated; no math painter/shrink wrapping |
@@ -346,7 +348,7 @@ 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**: custom `\sfcode` overrides, generic `fil`/`fill` glue orders and
- **M1**: generic `fil`/`fill` glue orders and
`\prevgraf` are still open; the tolerance, penalty and demerit registers,
`\hyphenation` exceptions, `\hangindent`/`\parshape`, `\parfillskip` with
or without `fil`, `\looseness`, `\baselineskip`/`\lineskip`/`\parskip`