From 2d73486dd1c6ab86c7e11dc72e119b412aeb4387 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Fri, 23 Oct 2026 14:43:57 +0800 Subject: [PATCH] Cover tolerance-10000 line breaking with pdfLaTeX --- crates/texrra-tex-core/tests/oracle.rs | 11 +++++++++++ docs/ROUTE_D_PLAN.md | 8 +++++--- docs/TEX_CORE.md | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/texrra-tex-core/tests/oracle.rs b/crates/texrra-tex-core/tests/oracle.rs index 359a389..319ccf0 100644 --- a/crates/texrra-tex-core/tests/oracle.rs +++ b/crates/texrra-tex-core/tests/oracle.rs @@ -408,6 +408,17 @@ fn pretolerance_skips_hyphenation_like_tex() { }); } +/// `\tolerance=10000` accepts arbitrarily bad underfull lines in the +/// tolerance pass, so the breaker must consider very loose breaks. +#[test] +fn tolerance_10000_matches_pdftex() { + for width in [100, 120, 150, 180, 200, 240] { + compare_fixture_with(WORDS, width, "\\tolerance=10000 ", |style| { + style.tolerance = 10_000; + }); + } +} + /// `\hyphenpenalty=10000` makes hyphenation illegal, so the final pass keeps /// overfull lines instead. #[test] diff --git a/docs/ROUTE_D_PLAN.md b/docs/ROUTE_D_PLAN.md index 95e5bdb..562faf4 100644 --- a/docs/ROUTE_D_PLAN.md +++ b/docs/ROUTE_D_PLAN.md @@ -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`). 446 workspace tests are green and no oracle +PDF opt-in with `?engine=route-d`). 447 workspace tests are green and no oracle fixture is ignored. Known gaps, in dependency order: @@ -241,8 +241,10 @@ lines outside the emergency pass, exactly like TeX, so `\tolerance` cannot smuggle in a single overfull line any more. Hyphenated breaks are checked at 80-120pt, and a 70/85pt fixture sets `\doublehyphendemerits` and `\finalhyphendemerits` to 0 and 10000 so both demerits change the reference -breaks; at `\tolerance=10000` the line count matches pdfLaTeX but the first -line boundary still differs, which stays documented as a known approximation. +breaks; at `\tolerance=10000` the wide-measure fixture now matches pdfLaTeX at +100-240pt, but narrow measures (70/85pt) still pick different hyphenated +breaks because the demerits optimum differs; that stays documented as a +known approximation. ### P2 — Vertical list, page builder, `\output` (L2) diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 55f67b0..c8b98c6 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -355,7 +355,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 296 unit tests plus seven route-D integration tests and twenty-nine oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 446 tests (296 route-D unit, 7 route-D integration, 29 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 12 binary units), with none ignored. v1 remains the live server path. +The crate currently has 296 unit tests plus seven route-D integration tests and thirty oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 447 tests (296 route-D unit, 7 route-D integration, 30 oracle, 71 v1 integration, 26 server, 4 v1 unit, 1 core unit, 12 binary units), with none ignored. v1 remains the live server path. ### M0 incremental demo