Embed a TrueType Roman font in route-D PDFs

This commit is contained in:
gloamxun committed 2026-10-20 20:49:21 +08:00
1 parent a703f2dcc0
commit a09398811f
5 files changed
+95 -12

No files matched your search

+4 -5
View File
@@ -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; embedded `cmr10.tfm` is parsed at runtime for widths/height/depth, but PDF font embedding and real NFSS families are absent |
| M5 NFSS/TFM | partial | runtime `cmr10.tfm` widths/heights/depths; Roman text embeds Liberation Serif as a Type0 CID font with Identity-H and ToUnicode; Bold/Italic/Mono still use Base-14 faces; SVG carries family/weight/style |
| 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 |
@@ -249,9 +249,9 @@ v1 remains the production renderer; the route-D core is additive and tested inde
M3 painter: `Page::display_list()` and `Halign::display_list()` produce absolute text, rule and line primitives. `DisplayList::to_svg()` writes a standalone SVG; paragraph glyphs and math atoms are painted at their measured positions.
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.
PDF writer: `crates/texrra-tex-core/src/pdf.rs` writes multi-page PDF 1.4 with an embedded Liberation Serif Type0/CID font (Identity-H + ToUnicode) for Roman text, Base-14 faces for the other styles, filled rectangles, diagonal rules, raw-RGB `/XObject` images, `/Annots` URI links and arbitrary `/special` operators. Real NFSS faces and subsets for bold/italic 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. The embedded `cmr10.tfm` is parsed at runtime; PDF font embedding, ligature/kern tables and real NFSS families are still open.
M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic,Mono}`. Roman text is painted with an embedded Liberation Serif Type0/CID font and a ToUnicode CMap; the other faces still map to Base-14 Times/Courier. `cmr10.tfm` is parsed at runtime for widths and heights/depths; ligature/kern tables and true NFSS family switching remain 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,8 +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**: `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.
- **M5**: `cmr10.tfm` is parsed at runtime with widths and glyph heights/depths. Roman text embeds Liberation Serif as Type0/Identity-H, but bold/italic/mono still use Base-14 faces; ligature/kern tables and full NFSS family switching are not implemented.
- **M6**: `\output`, `\insert`, mark/float output policies, class-file execution and
math limit policies are only partially modeled.
- **M7**: the route-D engine is not yet wired into the v1 live preview. The server