From a703f2dcc07f333f363b2a76e2b8e57dae2fefa4 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Tue, 20 Oct 2026 20:46:14 +0800 Subject: [PATCH] Wire the TFM parser into the route-D core --- crates/texrra-tex-core/src/lib.rs | 1 + docs/TEX_CORE.md | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/texrra-tex-core/src/lib.rs b/crates/texrra-tex-core/src/lib.rs index ba22b61..21ff79e 100644 --- a/crates/texrra-tex-core/src/lib.rs +++ b/crates/texrra-tex-core/src/lib.rs @@ -3,6 +3,7 @@ pub mod math; pub mod paragraph; pub mod pdf; pub mod render; +pub mod tfm; pub use cmr10::Cmr10Metrics; pub use paragraph::{ diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 15ea221..c8fa44b 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -229,7 +229,7 @@ for a later overlaid slash. | M2 vertical/page builder | partial | vsize, topskip, insertions, marks, output hook, top/bottom floats, rules, vskip, penalties; interpreted `\output` and float pages absent | | M3 halign | partial | natural columns, spans, omit, hline rows, templates, noalign skip, rules; no PDF painter | | M4 math | partial | atoms, scripts, fractions, roots, delimiters, accents, operators, classes, braces, boxed, negated; no math painter/shrink wrapping | -| M5 NFSS/TFM | partial | CMR10 widths, per-face Base-14 PDF resources, and SVG font-family/weight/style for Roman/Bold/Italic/Mono; paragraph units carry a ParagraphFont face; TFM loading and font embedding absent | +| M5 NFSS/TFM | partial | CMR10 widths, per-face Base-14 PDF resources, and SVG font-family/weight/style for Roman/Bold/Italic/Mono; paragraph units carry a ParagraphFont face; embedded `cmr10.tfm` is parsed at runtime for widths/height/depth, but PDF font embedding and real NFSS families are absent | | M6 specials/XObject | partial | raw specials, RGB image XObjects, URI link annotations; class/package execution absent | | M7 incremental integration | partial | edit replay + page hashes, not wired into v1 preview | @@ -251,7 +251,7 @@ M3 painter: `Page::display_list()` and `Halign::display_list()` produce absolute PDF writer: `crates/texrra-tex-core/src/pdf.rs` writes multi-page PDF 1.4 with Base-14 Times/Courier resources, filled rectangles, diagonal rules, raw-RGB `/XObject` images, `/Annots` URI links and arbitrary `/special` operators. TFM/NFSS embedded fonts remain open. -M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic,Mono}`; PDF resources map them to Times and Courier faces, and SVG emits matching family/weight/style. TFM parsing and embedded font subsets are still open. +M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic,Mono}`; PDF resources map them to Times and Courier faces, and SVG emits matching family/weight/style. The embedded `cmr10.tfm` is parsed at runtime; PDF font embedding, ligature/kern tables and real NFSS families are still open. M6 (partial): `DisplayItem::Image` becomes a PDF XObject; `DisplayItem::Link` becomes `/Annots /Subtype /Link /URI`; `DisplayItem::Special` injects raw content-stream operators. SVG previews show images as grey rectangles and specials as comments. @@ -288,7 +288,7 @@ deliberately open rather than approximated: - **M1**: TeX tolerance/demerits are still fitted to a few fixtures; multi-width pdfTeX line breaks and full hyphenation demerits are not reproduced generally. -- **M5**: TFM parsing and embedded NFSS fonts are not implemented. Display-list text +- **M5**: `cmr10.tfm` is parsed at runtime with widths and glyph heights/depths, but embedded NFSS fonts are not implemented. Display-list text uses Base-14 Times/Courier faces; Unicode coverage beyond Latin-1 is limited. - **M6**: `\output`, `\insert`, mark/float output policies, class-file execution and math limit policies are only partially modeled.