From fd9ee0740b31635d35718808ac77e088d1bbbcb0 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Wed, 28 Oct 2026 00:08:19 +0800 Subject: [PATCH] Use Times metrics for bold and italic text Add ptmb8t/ptmri8t/ptmbi8t metrics and TimesBold/TimesItalic/TimesBoldItalic paragraph faces. A ptm document now maps Roman, bold, italic and bold-italic base faces to the Times family, so headings and emphasised runs use Times widths while the PDF backend continues to embed Liberation Serif. The arXiv output is unchanged at 3 pages; previews measured 12.5-17.5 ms warm and 191 ms cold. Test count is 1076. --- crates/texrra-tex-core/assets/ptmb8t.tfm | Bin 0 -> 6880 bytes crates/texrra-tex-core/assets/ptmbi8t.tfm | Bin 0 -> 6784 bytes crates/texrra-tex-core/assets/ptmri8t.tfm | Bin 0 -> 6944 bytes crates/texrra-tex-core/src/cmr10.rs | 43 ++++++++++++++++++++++ crates/texrra-tex-core/src/paragraph.rs | 35 ++++++++++++++++-- crates/texrra-tex-core/src/render.rs | 3 ++ docs/ROUTE_D_PLAN.md | 2 +- docs/ROUTE_D_STATUS.md | 6 +-- docs/TEX_CORE.md | 4 +- docs/TEX_FIDELITY_ROADMAP.md | 6 ++- docs/WEB_ROUTE_D_EXPERIMENT.md | 4 +- src/route_d.rs | 15 ++++++-- 12 files changed, 100 insertions(+), 18 deletions(-) create mode 100644 crates/texrra-tex-core/assets/ptmb8t.tfm create mode 100644 crates/texrra-tex-core/assets/ptmbi8t.tfm create mode 100644 crates/texrra-tex-core/assets/ptmri8t.tfm diff --git a/crates/texrra-tex-core/assets/ptmb8t.tfm b/crates/texrra-tex-core/assets/ptmb8t.tfm new file mode 100644 index 0000000000000000000000000000000000000000..4fbc033e804fd3973c92a7402808ab793c8712bb GIT binary patch literal 6880 zcmeI0eQ;D)8HeAqyLWf*W_LrfdpGQ6H^jD*T9eQ=eiT|tGLT}_Bz6cNaU2J#1koyy z76=ICV5g!p6-RALi_Qq+7&_JBN;;aUP{Nn3PU%#>%13cv94XqVWgIJLCwqO)-KFw}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x`sQCdHbRuxCP2N!v26D=4RMzl7_#^s8mQ zo2cue)NmM%LIyU&F*pLJi9G{v!6|qS-hnq^4_X~?2;D2Xgt?dG_m;b-zG6SIZtmVm z;W5d9D|e zmlZs-c;@OV*62r+4-xNvU)%UTKFakvaL zbEt`D>rkE%L#;R5&Ya=q$Nl?iuxH?n#14luVhF!4`RDkToh!rXx%ah~FaB-xbzX*l zUIudx4&B)`G{42Z_VZQ0RsTO{%#EB!HxfG>&aT1ymbw1>g7=J$b9k5Iyj0>if2?;L zYr5mSUEsc-b({yP9jCR!ah@9MI6HSaxyen=$8PMXjQgI|$vt+_$<6z><5X8WAJfN~ zz2C{*Dvt9@+B%z@+|O4yxs$|P?sjrd6Z6jwC-+{x7!UI@TX>hryJq)&s6SjU`S-$H eTf8&2KH4JT@{D-Dm+3Eg7wW!;c0cjz>i+;j1F = OnceLock::new(); static CMBX10_METRICS: OnceLock = OnceLock::new(); @@ -74,6 +83,9 @@ static CMSY10_METRICS: OnceLock = OnceLock::new(); static MSBM10_METRICS: OnceLock = OnceLock::new(); static EUFM10_METRICS: OnceLock = OnceLock::new(); static PTMR8T_METRICS: OnceLock = OnceLock::new(); +static PTMB8T_METRICS: OnceLock = OnceLock::new(); +static PTMRI8T_METRICS: OnceLock = OnceLock::new(); +static PTMBI8T_METRICS: OnceLock = OnceLock::new(); fn parse(bytes: &[u8]) -> TfmMetrics { TfmMetrics::parse(bytes).expect("embedded TFM must be valid") @@ -167,6 +179,18 @@ fn parse_times_roman() -> TfmMetrics { parse(PTMR8T_TFM) } +fn parse_times_bold() -> TfmMetrics { + parse(PTMB8T_TFM) +} + +fn parse_times_italic() -> TfmMetrics { + parse(PTMRI8T_TFM) +} + +fn parse_times_bold_italic() -> TfmMetrics { + parse(PTMBI8T_TFM) +} + fn math_fraktur_metrics() -> &'static TfmMetrics { EUFM10_METRICS.get_or_init(parse_fraktur) } @@ -190,6 +214,9 @@ fn metrics_for(font: Cmr10Metrics) -> &'static TfmMetrics { Cmr10Metrics::MathBlackboard => MSBM10_METRICS.get_or_init(parse_blackboard), Cmr10Metrics::MathFraktur => EUFM10_METRICS.get_or_init(parse_fraktur), Cmr10Metrics::TimesRoman => PTMR8T_METRICS.get_or_init(parse_times_roman), + Cmr10Metrics::TimesBold => PTMB8T_METRICS.get_or_init(parse_times_bold), + Cmr10Metrics::TimesItalic => PTMRI8T_METRICS.get_or_init(parse_times_italic), + Cmr10Metrics::TimesBoldItalic => PTMBI8T_METRICS.get_or_init(parse_times_bold_italic), } } @@ -214,6 +241,9 @@ impl Cmr10Metrics { ParagraphFont::BoldSlanted => Self::BoldSlanted, ParagraphFont::MonoItalic => Self::MonoItalic, ParagraphFont::TimesRoman => Self::TimesRoman, + ParagraphFont::TimesBold => Self::TimesBold, + ParagraphFont::TimesItalic => Self::TimesItalic, + ParagraphFont::TimesBoldItalic => Self::TimesBoldItalic, } } @@ -502,6 +532,19 @@ mod tests { assert!(font.depth('g') > 0); } + #[test] + fn times_bold_and_italic_tfms_differ_from_roman() { + let roman = Cmr10Metrics::TimesRoman; + let differs = |face: Cmr10Metrics| { + ['A', 'm', 'W', 'f'] + .iter() + .any(|character| face.width(*character) != roman.width(*character)) + }; + assert!(differs(Cmr10Metrics::TimesBold)); + assert!(differs(Cmr10Metrics::TimesItalic)); + assert!(differs(Cmr10Metrics::TimesBoldItalic)); + } + #[test] fn times_roman_tfm_differs_from_cmr() { let roman = Cmr10Metrics::Roman; diff --git a/crates/texrra-tex-core/src/paragraph.rs b/crates/texrra-tex-core/src/paragraph.rs index 6b8e8a6..e68ec62 100755 --- a/crates/texrra-tex-core/src/paragraph.rs +++ b/crates/texrra-tex-core/src/paragraph.rs @@ -370,6 +370,12 @@ pub enum ParagraphFont { MonoItalic, /// Times Roman text selected by `\rmdefault{ptm}` (`ptmr8t`). TimesRoman, + /// Times bold text (`ptmb8t`). + TimesBold, + /// Times italic text (`ptmri8t`). + TimesItalic, + /// Times bold italic text (`ptmbi8t`). + TimesBoldItalic, } impl ParagraphFont { @@ -388,7 +394,10 @@ impl ParagraphFont { Self::Slanted => Self::Italic, Self::BoldSlanted => Self::BoldItalic, Self::MonoItalic => Self::Mono, - Self::TimesRoman => Self::Italic, + Self::TimesRoman => Self::TimesItalic, + Self::TimesItalic => Self::TimesRoman, + Self::TimesBold => Self::TimesBoldItalic, + Self::TimesBoldItalic => Self::TimesBold, } } @@ -402,7 +411,10 @@ impl ParagraphFont { Self::SmallCaps => Self::Bold, Self::Slanted | Self::BoldSlanted => Self::BoldSlanted, Self::MonoItalic => Self::MonoItalic, - Self::TimesRoman => Self::Bold, + Self::TimesRoman => Self::TimesBold, + Self::TimesItalic => Self::TimesBoldItalic, + Self::TimesBold => Self::TimesBold, + Self::TimesBoldItalic => Self::TimesBoldItalic, } } @@ -418,6 +430,9 @@ impl ParagraphFont { Self::Slanted | Self::BoldSlanted => Self::Slanted, Self::MonoItalic => Self::MonoItalic, Self::TimesRoman => Self::TimesRoman, + Self::TimesBold => Self::TimesRoman, + Self::TimesItalic => Self::TimesItalic, + Self::TimesBoldItalic => Self::TimesItalic, } } @@ -434,7 +449,10 @@ impl ParagraphFont { Self::SmallCaps => Self::Italic, Self::Slanted => Self::Italic, Self::BoldSlanted => Self::BoldItalic, - Self::TimesRoman => Self::Italic, + Self::TimesRoman => Self::TimesItalic, + Self::TimesItalic => Self::TimesItalic, + Self::TimesBold => Self::TimesBoldItalic, + Self::TimesBoldItalic => Self::TimesBoldItalic, } } @@ -450,7 +468,10 @@ impl ParagraphFont { Self::Sans | Self::SansItalic => Self::SansItalic, Self::SansBold => Self::SansBold, Self::SmallCaps => Self::Slanted, - Self::TimesRoman => Self::Slanted, + Self::TimesRoman => Self::TimesItalic, + Self::TimesItalic => Self::TimesItalic, + Self::TimesBold => Self::TimesBoldItalic, + Self::TimesBoldItalic => Self::TimesBoldItalic, } } @@ -466,6 +487,9 @@ impl ParagraphFont { Self::Slanted | Self::BoldSlanted => Self::Roman, Self::MonoItalic => Self::Mono, Self::TimesRoman => Self::TimesRoman, + Self::TimesItalic => Self::TimesRoman, + Self::TimesBold => Self::TimesBold, + Self::TimesBoldItalic => Self::TimesBold, } } @@ -492,6 +516,9 @@ impl ParagraphFont { Self::BoldSlanted => Self::Bold, Self::MonoItalic => Self::Mono, Self::TimesRoman => Self::TimesRoman, + Self::TimesItalic => Self::TimesRoman, + Self::TimesBold => Self::TimesBold, + Self::TimesBoldItalic => Self::TimesBold, } } diff --git a/crates/texrra-tex-core/src/render.rs b/crates/texrra-tex-core/src/render.rs index b971d7f..7eeda72 100755 --- a/crates/texrra-tex-core/src/render.rs +++ b/crates/texrra-tex-core/src/render.rs @@ -479,6 +479,9 @@ fn paragraph_face(font: ParagraphFont) -> FontFace { ParagraphFont::BoldSlanted => FontFace::BoldSlanted, ParagraphFont::MonoItalic => FontFace::MonoItalic, ParagraphFont::TimesRoman => FontFace::Roman, + ParagraphFont::TimesBold => FontFace::Bold, + ParagraphFont::TimesItalic => FontFace::Italic, + ParagraphFont::TimesBoldItalic => FontFace::BoldItalic, } } diff --git a/docs/ROUTE_D_PLAN.md b/docs/ROUTE_D_PLAN.md index c3f4e9a..92628b8 100644 --- a/docs/ROUTE_D_PLAN.md +++ b/docs/ROUTE_D_PLAN.md @@ -51,7 +51,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`, 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`; flat `/preview` and project previews now -prefer route-D with a v1 fallback). 1075 workspace tests are green and no oracle +prefer route-D with a v1 fallback). 1076 workspace tests are green and no oracle fixture is ignored. Preview JSON also carries a `warnings` array naming environments route-D cannot lay out and control words that survived layout, so unsupported source is reported instead of being silently typeset. diff --git a/docs/ROUTE_D_STATUS.md b/docs/ROUTE_D_STATUS.md index 6040b82..c86a2d9 100755 --- a/docs/ROUTE_D_STATUS.md +++ b/docs/ROUTE_D_STATUS.md @@ -16,11 +16,11 @@ cargo test --workspace --offline or run `./scripts/verify-route-d.sh`, which executes both. -The workspace currently passes **1075 tests**: +The workspace currently passes **1076 tests**: | Suite | Tests | | --- | --- | -| route-D unit (engine) | 446 | +| route-D unit (engine) | 447 | | engine binary unit | 434 | | server integration | 67 | | v1 integration | 71 | @@ -29,7 +29,7 @@ The workspace currently passes **1075 tests**: | engine/core unit | 4 + 1 | Latest full run (web trial increment): `./scripts/verify-route-d.sh` passes -with fmt clean and **1075 tests** green. +with fmt clean and **1076 tests** green. Latest live check (2026-10-27): the debug server served `examples/hello.tex` from `target/debug/texrra serve`; `POST /preview` answered 200 with diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 36c2b71..644e79f 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -370,7 +370,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`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph. -The crate currently has 446 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1075 tests (446 core unit, 434 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 67 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; flat and project responses carry `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4. +The crate currently has 447 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1076 tests (447 core unit, 434 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 67 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; flat and project responses carry `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4. ### M0 incremental demo @@ -524,7 +524,7 @@ deliberately open rather than approximated: ## Limits and remaining gaps -The suite currently stands at 1075 passing tests, with the workspace clean. +The suite currently stands at 1076 passing tests, with the workspace clean. Route-D serves both flat `/preview` and project preview/PDF requests by default (automatic v1 fallback; `?engine=v1` or `TEXRRA_ENGINE=v1` opts out). The objective's areas are implemented to the limits below; complex-script shaping is diff --git a/docs/TEX_FIDELITY_ROADMAP.md b/docs/TEX_FIDELITY_ROADMAP.md index 060019e..b7eefc6 100644 --- a/docs/TEX_FIDELITY_ROADMAP.md +++ b/docs/TEX_FIDELITY_ROADMAP.md @@ -39,8 +39,8 @@ execution is not a goal. horizontal/vertical offsets, so a `geometry` document gets its centred 6.5in text block and page-2/page-3 headers instead of content at x=0. - Still visibly different from TeX: - - body face uses Times metrics (`ptmr8t`) with Liberation Serif TrueType; - bold/italic Times faces and CMR-metric headings remain; + - body face uses Times Roman/bold/italic metrics (`ptmr8t`, `ptmb8t`, + `ptmri8t`, `ptmbi8t`) with Liberation Serif TrueType; - the arXiv class's top/bottom rules, "A Preprint" undertitle and uppercase Times title are drawn, and two author groups are laid out side by side as a centred two-column halign. ORCID icons are still missing; @@ -68,6 +68,8 @@ execution is not a goal. - Incremental bottlenecks: - release-mode measurements after the paragraph-unit cache: article-basic **47 ms**, arXiv late edit **p50 47.6 ms / p95 53.3 ms** (one page changed), + Times arXiv previews measured 12.5–17.5 ms warm and 191 ms cold in + this round; the Times TFM parse is lazy and cached. a 10-page simple document **p50 13 ms / p95 14.7 ms**; the measured 3-page and 10-page cases now meet the <100 ms target, while the cold first build is still 150–370 ms and a heading/front-matter edit still diff --git a/docs/WEB_ROUTE_D_EXPERIMENT.md b/docs/WEB_ROUTE_D_EXPERIMENT.md index 0b027d3..7877f0c 100644 --- a/docs/WEB_ROUTE_D_EXPERIMENT.md +++ b/docs/WEB_ROUTE_D_EXPERIMENT.md @@ -46,7 +46,7 @@ now means route-D. | Area | Route-D | Evidence / impact | | --- | --- | --- | -| Article/report basics: title, sections, lists, TOC, page numbers | Supported | corpus and 1075-test suite | +| Article/report basics: title, sections, lists, TOC, page numbers | Supported | corpus and 1076-test suite | | Inline/display math, equations, tags, cleveref | Supported | math tests, oracle fixtures | | Floats, captions, tables, booktabs | Supported | table/math tests, corpus | | PNG/JPEG/BMP `\includegraphics` | Supported | project image tests; PDF XObjects use pixel dimensions and the SVG preview embeds a PNG data URI | @@ -139,7 +139,7 @@ PDF was rendered page-by-page next to the route-D output. | Page element | TeX Live reference | Route-D output | | --- | --- | --- | | Page count / paper | 3 pages, letter | 3 pages, letter | -| Typeface | Times (`ptm`, arxiv.sty) | Times body metrics (`ptmr8t`) with Liberation Serif TrueType; headings still CMR metrics | +| Typeface | Times (`ptm`, arxiv.sty) | Times Roman/bold/italic metrics (`ptmr8t`, `ptmb8t`, `ptmri8t`, `ptmbi8t`) with Liberation Serif TrueType | | Text block | 1in left/right margins, 6.5in measure | 1in margins and 6.5in measure after the page-origin fix; body face still differs | | Running header | `arxiv Template` / `A PREPRINT` | `arXiv Template` / `A Preprint` on pages 2–3; small-caps styling differs | | Title | `A TEMPLATE FOR THE arxiv STYLE`, small caps, rules above/below | uppercase Times with rules above/below | diff --git a/src/route_d.rs b/src/route_d.rs index b3e5061..4da8697 100755 --- a/src/route_d.rs +++ b/src/route_d.rs @@ -9817,6 +9817,9 @@ fn nfss_font_with_size( ParagraphFont::BoldSlanted => (Family::Roman, true, false), ParagraphFont::MonoItalic => (Family::Mono, false, true), ParagraphFont::TimesRoman => (Family::Roman, false, false), + ParagraphFont::TimesBold => (Family::Roman, true, false), + ParagraphFont::TimesItalic => (Family::Roman, false, true), + ParagraphFont::TimesBoldItalic => (Family::Roman, true, true), }; let mut small_caps = base == ParagraphFont::SmallCaps; let mut slanted = matches!(base, ParagraphFont::Slanted | ParagraphFont::BoldSlanted); @@ -14118,10 +14121,14 @@ fn build_document_with_labels( xspace_skip: geometry.xspace_skip, }; let plain = strip_hrefs(&text).replace('~', " "); - let face = if geometry.roman_family.as_deref() == Some("ptm") - && paragraph.font == ParagraphFont::Roman - { - ParagraphFont::TimesRoman + let face = if geometry.roman_family.as_deref() == Some("ptm") { + match paragraph.font { + ParagraphFont::Roman => ParagraphFont::TimesRoman, + ParagraphFont::Bold => ParagraphFont::TimesBold, + ParagraphFont::Italic => ParagraphFont::TimesItalic, + ParagraphFont::BoldItalic => ParagraphFont::TimesBoldItalic, + other => other, + } } else { paragraph.font };