Model TeX demerit registers and hyphenation exceptions
This commit is contained in:
1 parent
3725cca9d7
commit
24a96d1c7c
5 files changed
+153
-34
No files matched your search
+14
-9
@@ -73,8 +73,10 @@ 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. 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.
|
||||
`\exhyphenpenalty`, `\linepenalty`, `\adjdemerits`,
|
||||
`\doublehyphendemerits`, `\finalhyphendemerits` and `\emergencystretch`,
|
||||
plus document-level `\hyphenation` exceptions; `\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
|
||||
@@ -114,10 +116,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. 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.
|
||||
tolerance bounds, break penalties and flagged demerits are modelled, and
|
||||
`\hyphenation` exceptions are inserted into the pattern trie. Remaining gaps
|
||||
are `\looseness`, `\parshape`, `\hangindent`, spacefactor/`\sfcode`,
|
||||
`\parfillskip`/fil glue orders, and the vertical-list skips
|
||||
(`\baselineskip`, `\lineskip`, `\parskip`).
|
||||
|
||||
The pdfLaTeX oracle pins six measures (100-240pt) and all match; no oracle
|
||||
fixture is ignored.
|
||||
@@ -289,7 +292,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 179 unit tests plus six route-D integration tests and two oracle fixtures (one ignored). Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 282 tests (179 route-D unit, 6 route-D integration, 2 oracle, 71 v1 integration, 19 server, 4 v1 unit, 1 core unit, 2 binary units), of which one is ignored. v1 remains the live server path.
|
||||
The crate currently has 181 unit tests plus six route-D integration tests and five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 289 tests (181 route-D unit, 6 route-D integration, 5 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
|
||||
|
||||
@@ -317,8 +320,10 @@ 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**: explicit `\tolerance`/`\pretolerance` registers, hyphenated-break
|
||||
penalties and more width fixtures are still open.
|
||||
- **M1**: `\parshape`, `\looseness`, `\hangindent`, spacefactor/`\sfcode`,
|
||||
`\parfillskip`/fil glue orders and the vertical-list skips are still open;
|
||||
the tolerance, penalty and demerit registers plus `\hyphenation` exceptions
|
||||
are modelled.
|
||||
- **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; `\output` is still Rust code rather than interpreted tokens.
|
||||
|
||||
Reference in new issue
Block a user