Model TeX tolerance and hyphen penalty registers
This commit is contained in:
1 parent
4fbc43f5ff
commit
3725cca9d7
6 files changed
+148
-23
No files matched your search
@@ -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`). 286 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 288 workspace tests are green and no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Known gaps, in dependency order:
|
||||
@@ -166,7 +166,9 @@ nominal stretch while clamping shrink at the declared limit, and falls back to
|
||||
the longest prefix within `\tolerance` or the first overflowing prefix. The
|
||||
oracle compares 100, 120, 150, 180, 200 and 240pt and all six match pdfLaTeX
|
||||
word for word within 0.05pt; the narrow measures exercise hyphenated and
|
||||
overfull breaks.
|
||||
overfull breaks. Register fixtures pin `\pretolerance=10000` (pass 0 stops
|
||||
before hyphenation) and `\hyphenpenalty=10000` (hyphenation illegal, first-fit
|
||||
overfull lines).
|
||||
|
||||
Still open: explicit `\tolerance`/`\pretolerance` overrides, flagged
|
||||
(hyphenated) demerits, `\parfillskip` variants, `\hangindent`/`\parshape`,
|
||||
|
||||
+13
-7
@@ -71,13 +71,18 @@ the fallback here mirrors that choice by taking the longest prefix within
|
||||
tolerance and otherwise the first prefix that overflows. Justification
|
||||
stretches normal glue past its nominal stretch (badness simply exceeds 100)
|
||||
and clamps shrink at the declared limit, so overfull lines stay overfull
|
||||
exactly as in TeX.
|
||||
exactly as in TeX. The bounds and hyphen demerits are `ParagraphStyle`
|
||||
fields mirroring `\pretolerance`, `\tolerance`, `\hyphenpenalty` and
|
||||
`\exhyphenpenalty`; `\hyphenpenalty` at 10000 or more disables hyphenation
|
||||
and switches the fallback to a first-fit scan.
|
||||
|
||||
`tests/oracle.rs` compares a matrix of measures (100, 120, 150, 180, 200 and
|
||||
240pt) against pdfLaTeX: every fixture matches word for word and within 0.05pt
|
||||
horizontally. The narrow measures exercise hyphenated and overfull breaks,
|
||||
150pt the final-pass overfull box, and 180-240pt ordinary tolerance
|
||||
solutions. `route_d_multiline_bands_track_pdftex` rasterizes the same
|
||||
solutions. Two further fixtures pin register behaviour at 120pt:
|
||||
`\pretolerance=10000` stops before hyphenation and `\hyphenpenalty=10000`
|
||||
inhibits it, leaving the overfull first-fit lines TeX produces. `route_d_multiline_bands_track_pdftex` rasterizes the same
|
||||
paragraph in both engines and compares ink bands, covering baseline placement
|
||||
and justification.
|
||||
|
||||
@@ -96,7 +101,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, pdfLaTeX oracle matrix 100-240pt; explicit tolerance registers, `\looseness`, `\parshape` and more fixtures 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, pdfLaTeX oracle matrix 100-240pt plus register fixtures; `\looseness`, `\parshape` and more fixtures 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; interpreted `\output`, float pages 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 |
|
||||
@@ -108,10 +113,11 @@ and justification.
|
||||
|
||||
- The M1 paragraph builder parses CMR10 TFM metrics (widths, height/depth,
|
||||
italic correction, kern pairs, ligatures), applies TeX Live's en-US
|
||||
hyphenation patterns and runs TeX's tolerance passes with demerits. Remaining
|
||||
gaps are explicit `\tolerance`/`\pretolerance` overrides (the defaults and
|
||||
`\emergencystretch` are modelled), `\hyphenpenalty`/`\exhyphenpenalty`,
|
||||
`\looseness`, `\parshape` and `\parfillskip` variants.
|
||||
hyphenation patterns and runs TeX's tolerance passes with demerits. The
|
||||
tolerance bounds and hyphen penalties are modelled. Remaining gaps are
|
||||
`\looseness`, `\parshape`, `\parfillskip` variants, document-level
|
||||
`\hyphenation` exceptions (the TeX Live exception list is loaded) and the
|
||||
`\adjdemerits`/`\doublehyphendemerits`/`\finalhyphendemerits` registers.
|
||||
|
||||
The pdfLaTeX oracle pins six measures (100-240pt) and all match; no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Reference in new issue
Block a user