diff --git a/README.md b/README.md index 4074ef0..eb5e491 100644 --- a/README.md +++ b/README.md @@ -466,7 +466,7 @@ from the font's MATH assembly parts. `\\left...\\right` target sizing follows the assignable TeX parameters `\\delimiterfactor` (default 901) and `\\delimitershortfall` (default 5pt), including local and global assignments. -Route-D integration can also be checked against a real TeX page: `cargo test -p texrra-tex-core --test route_d` includes `route_d_page_matches_pdftex_raster_geometry`, which renders the route-D PDF and a pdfTeX page at the same geometry, rasterizes both with `pdftoppm`, and compares ink line and edge positions. It is skipped when `pdflatex`/`pdftoppm` are unavailable. +Route-D integration can also be checked against a real TeX page: `cargo test -p texrra-tex-core --test route_d` includes `route_d_page_matches_pdftex_raster_geometry`, which renders the route-D PDF and a pdfTeX Letter page at the same scaled-point geometry, rasterizes both with `pdftoppm`, and compares ink line count plus left, right, and bottom edges. It is skipped when `pdflatex`/`pdftoppm` are unavailable. Route-D float placement mirrors TeX fractions: diff --git a/crates/texrra-tex-core/tests/route_d.rs b/crates/texrra-tex-core/tests/route_d.rs index a8800c1..2560c1a 100755 --- a/crates/texrra-tex-core/tests/route_d.rs +++ b/crates/texrra-tex-core/tests/route_d.rs @@ -52,15 +52,15 @@ fn route_d_article_exports_pdf_and_reflows_only_the_edited_page() { fn route_d_page_matches_pdftex_raster_geometry() { use std::process::Command; - fn has(command: &str) -> bool { + fn has(command: &str, version_arg: &str) -> bool { Command::new(command) - .arg("--version") + .arg(version_arg) .stdout(std::process::Stdio::null()) .stderr(std::process::Stdio::null()) .status() .is_ok_and(|status| status.success()) } - if !has("pdflatex") || !has("pdftoppm") { + if !has("pdflatex", "--version") || !has("pdftoppm", "-v") { return; } @@ -124,7 +124,23 @@ fn route_d_page_matches_pdftex_raster_geometry() { let _ = std::fs::remove_dir_all(&root); std::fs::create_dir_all(&root).expect("create raster dir"); - let document = Document::new(700 * 65536, vec![Unit::paragraph(1, "Hello route-D")]); + let style = ParagraphStyle { + line_width: 480 * 65_536, + left_skip: 0, + right_skip: 0, + centered: false, + right_aligned: false, + par_indent: 0, + line_height: 12 * 65_536, + char_width: 10 * 65_536, + space_width: 4 * 65_536, + space_stretch: 6 * 65_536, + space_shrink: 2 * 65_536, + }; + let document = Document::new( + 700 * 65_536, + vec![Unit::paragraph_with_style(1, "Hello route-D", style)], + ); let engine = Engine::layout(&document); let pages: Vec<_> = engine .pages() @@ -143,6 +159,8 @@ fn route_d_page_matches_pdftex_raster_geometry() { \topmargin=0pt \headheight=0pt \headsep=0pt +\pdfpagewidth=612bp +\pdfpageheight=792bp \textwidth=480pt \textheight=700pt \topskip=10pt diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 905b85b..faf0c3e 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -267,7 +267,7 @@ M3 (partial): `Unit::halign` normalizes column widths, intercolumn gaps, row hei Math coverage includes fractions/roots, scripts, `\left...\right` with body-scaled delimiters, `\middle`, `\big`/`\Big`/`\bigg`/`\Bigg` and their `l`/`r` forms, control-sequence delimiters, accents (dot/check/breve/acute/grave/ring), `\text`/`\mathrm`, `\overbrace`/`\underbrace`, `\overset`/`\underset`, `\binom`, `\cancel`/`\bcancel`/`\xcancel`, `\bmod`/`\pmod`, fence symbols, `\operatorname*` and `\mathop` limits. -The crate currently has 153 unit tests plus two route-D integration tests. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 251 tests (153 route-D unit, 2 route-D integration, 71 v1 integration, 19 server, 4 v1 unit, 1 core unit, 1 doctest). v1 remains the live server path. +The crate currently has 153 unit tests plus two route-D integration tests. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 250 tests (153 route-D unit, 2 route-D integration, 71 v1 integration, 19 server, 4 v1 unit, 1 core unit, 1 doctest). v1 remains the live server path. ### M0 incremental demo @@ -309,6 +309,6 @@ deliberately open rather than approximated: through `Engine::edit` and reports the changed/recomputed pages, while structural edits fall back to a full layout. The v1 semantic pipeline remains the default fallback. LaTeX-to-route-D semantic mapping is still a subset, and - `route_d_page_matches_pdftex_raster_geometry` rasterizes the route-D PDF at 72 dpi and compares its ink line/left/bottom geometry against a pdfTeX page compiled with the same page geometry. The test skips on hosts without `pdflatex`/`pdftoppm`; exact glyph-outline pixel equality is still open because the two paths use different font outlines. + `route_d_page_matches_pdftex_raster_geometry` lays out a 480pt CMR10 paragraph at the same scaled-point geometry the server uses, rasterizes the route-D PDF and a pdfTeX Letter page at 72 dpi, and asserts matching ink line count plus left/right/bottom edges. It skips on hosts without `pdflatex`/`pdftoppm`. Exact glyph-outline pixel equality is still open because the two paths use different font outlines. - `\middle` does not scale with its enclosing delimiter; math delimiters are scaled glyphs rather than TeX delimiter variants.