diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 13e8926..9c1b187 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -247,30 +247,34 @@ v1 remains the production renderer; the route-D core is additive and tested inde `\mathstrut` is a zero-width strut with 7pt height and 2pt depth. -M3 painter prototype: `Page::display_list()` / `Halign::display_list()` produce absolute text and rule primitives, and `DisplayList::to_svg()` writes a standalone SVG. Paragraph text and math are not yet painted. +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. -Paragraph painter: `Unit::paragraph` now stores `VerticalItem::Paragraph`, and `Page::display_list()` paints each line's `HorizontalBox` characters at their line advance. Boxes created by hyphenation carry `-`; justification is approximated by item widths. +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. -Math painter: stores ; paints symbols, rows, scripts, fractions (with a rule), roots, delimiters, accents, underlines, boxes and stacks. Script/fraction positions are simplified TeX geometry. +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. -PDF writer: `src/pdf.rs` emits a one-page PDF 1.4 for a `DisplayList` (Base-14 Times-Roman text, filled rectangle rules, US Letter media box). It is a structural backend spike; TFM/NFSS fonts, XObjects and multi-page output 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. -M6 (partial): display-list Link rectangles become PDF /Annots /Subtype /Link /URI dictionaries. Raw-RGB images are PDF XObjects; /special and embedded font subsets remain. +M2 (partial): `Page::display_list_with_goal(page_goal)` places insertion material at `page_goal - insertion_height`, adds a 0.4pt separator above footnotes, and paints top/bottom float placeholders at the page edges. Real float contents and float-page fractions remain. -M7 (partial): DisplayList::special injects raw PDF content-stream operators; SVG previews show a comment. Driver-level \special parsing and coordinate transforms remain. +M3 (partial): `Unit::halign` normalizes column widths, intercolumn gaps, row heights and cell text widths to scaled points; the painter uses 10pt glyphs in 12pt rows. Rules and spans are painted; tall tables split at row boundaries (`Halign::split_for_height`) with column widths preserved. -M2 (partial): insertion material is expanded into the page display list at its reserved position, so footnote/float material is no longer dropped by the painter; page-bottom placement and rules remain to be modelled. - -M2 (partial): Page::display_list_with_goal places insertion material at page_goal minus its height; page builders can pass the real goal. Footnote rules and float-page policy remain. - -M2 (partial): a 0.4pt rule at 40% of the body width is painted above insertion material when a page goal is supplied. - -M2 (partial): top and bottom float placeholders are painted at the page edges in display lists; real float material and float-page fractions remain. - -M3 (partial): Unit::halign normalizes column widths, intercolumn gaps, row heights and cell text widths to scaled points; the display-list painter uses a 10pt glyph size inside 12pt rows. Rules and spans are painted; tall tables split at row boundaries across pages (split_for_height) with column widths preserved. +Math coverage includes fractions/roots, scripts, `\left...\right`, 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. ### M0 incremental demo - builds a -three-paragraph article, edits the middle paragraph, and prints the pages that -checkpoint replay rebuilt (expected ). +`crates/texrra-tex-core/examples/incremental_article.rs` builds a three-paragraph article, edits the middle paragraph, and prints the pages that checkpoint replay rebuilt. The expected result is page 2 only when the edit does not change page 1's content or the page count. + +Run it with: + +``` +cargo run -p texrra-tex-core --example incremental_article +``` + +### PDF smoke example + +`crates/texrra-tex-core/examples/pdf_display.rs` writes a Letter-size PDF with text, a rule, a 2x2 RGB XObject and a URI link: + +``` +cargo run -p texrra-tex-core --example pdf_display > /tmp/route-d.pdf +```