From 03aa1c5110b688c04e49bb610859853e33ced73e Mon Sep 17 00:00:00 2001 From: GloamXun Date: Fri, 23 Oct 2026 00:35:43 +0800 Subject: [PATCH] Record the P1 line-breaking experiment --- docs/ROUTE_D_PLAN.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/ROUTE_D_PLAN.md b/docs/ROUTE_D_PLAN.md index 82d9da4..660e8ea 100644 --- a/docs/ROUTE_D_PLAN.md +++ b/docs/ROUTE_D_PLAN.md @@ -154,6 +154,24 @@ Acceptance: 30 fixtures covering widths, indents, hyphenation, overfull and underfull lines; line break positions and overfull boxes identical to pdfLaTeX. +Status (P0 committed, P1 in progress): the oracle harness found and fixed two +real defects — the TFM lig/kern reader kept the last instruction for a shared +key instead of the first (`k` + `a` picked up `w`'s kern), and justification +squeezed overfull lines past their declared shrink. Both are fixed and the +150pt fixture now matches pdfLaTeX word for word. + +A demerits prototype (two-pass tolerance, fitness classes, `(line_penalty + +badness)^2` plus penalty and adjacency terms) was written and measured, then +reverted because it did not reproduce pdfLaTeX's emergency choices: it chose +`[26, 29]` at 150pt and `[6, 7, 10]` at 180pt where TeX chose `[30, 25]` and +`[7, 7, 8]`. The remaining work is exactly TeX's integer algorithm rather than +a floating-point approximation: fixed-point glue-set ratios, badness clamped to +10000 as soon as the ratio exceeds one, the three passes (`\pretolerance`, +`\tolerance`, emergency), fitness-class adjacency, double/final hyphen +demerits, `\parfillskip`'s infinite stretch for the final line, and TeX's +tie-breaking when two solutions have equal demerits. The 180pt oracle fixture +stays ignored until that lands. + ### P2 — Vertical list, page builder, `\output` (L2) Scope: