Commit Graph
108 Commits
Author SHA1 Message Date
gloamxun 7e5428ec35 Implement XeTeX native word ActualText across shaping and shipout 2026-11-25 23:38:47 +08:00
gloamxun 8be7867b37 Apply XDV color state and page backgrounds at shipout 2026-11-25 20:09:15 +08:00
gloamxun 794c2f9b2c Include PDF graphics in the native XeTeX device 2026-11-21 13:34:55 +08:00
gloamxun 70822cbd94 Shape and render explicit OpenType fonts in native Unicode jobs 2026-11-21 10:35:03 +08:00
gloamxun 28dfba5a5e Apply job-local PDF font maps at execution and shipout 2026-11-21 09:53:31 +08:00
gloamxun 9527d3bbec Reject automatic expansion of bitmap fonts at PDF shipout 2026-11-21 09:38:18 +08:00
gloamxun 614f09aa9b Register virtual fonts in native PDF shipout order 2026-11-21 09:18:03 +08:00
gloamxun 555a029505 Import PNG images in the native PDF device 2026-11-21 04:13:18 +08:00
gloamxun d1ddf4bfeb Apply native PDF page dictionaries and viewport projection 2026-11-21 03:31:00 +08:00
gloamxun 514a2d3344 Write PDF interword spaces with actual device fonts 2026-11-21 03:09:10 +08:00
gloamxun 432c1d2ba7 Emit native PDF literals at scan and shipout boundaries 2026-11-21 02:03:25 +08:00
gloamxun 4f4a4567ea Emit native PDF page resources and named transparency states 2026-11-21 00:53:46 +08:00
gloamxun ebbc9e2c17 Implement native automatic font expansion for paragraphs 2026-11-20 23:29:37 +08:00
gloamxun a53d9c9bf9 Implement native PDF links and vertical discard lists 2026-11-18 23:39:45 +08:00
gloamxun 2741546ca8 Advance native LaTeX execution and preview 2026-11-18 22:17:21 +08:00
gloamxun 96b40c1c2e Tighten large-operator lower limits 2026-10-29 00:15:15 +08:00
gloamxun 676eb7f323 Keep sum superscripts above the operator
Large-operator limits used the ordinary-base superscript gap, which could
leave N just below the sum baseline. Use a negative gap for large operators
so both limits straddle the operator, and add a unit test asserting the
subscript is below and the superscript above the base within 12pt.

Test count is 1080.
2026-10-28 08:28:17 +08:00
gloamxun 02742d201f Keep large-operator limits close to the operator
Display limits under \sum used the operator glyph depth, which pushed i=1 far
below the fraction and made the denominator look detached. Use the normal
limit gap for big operators while preserving the depth-based placement that
the existing \mathop oracle validates for ordinary bases.

Test count stays 1079.
2026-10-28 08:17:57 +08:00
gloamxun 742986e4dd Correct fraction depth and subscript placement
The fraction box added bar clearance twice to its depth, leaving extra space
below the denominator. Use the painted extent instead. Scripts now include
script space after the base, and subscripts drop by the base depth plus 2pt
rather than sitting on the baseline when the base has no depth.

Test count stays 1077.
2026-10-28 00:43:25 +08:00
gloamxun 764bc18850 Place display equation tags at the right margin
Tagged display math used the body width as its box, so the equation number sat
immediately after the formula. Add a TaggedWidth atom carrying the line
measure: the body is centred in the measure and the tag is painted at its right
edge.

The arXiv equation number now matches the TeX right-margin placement; the
formula body remains approximate. Test count stays 1077.
2026-10-28 00:32:56 +08:00
gloamxun fd9ee0740b 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.
2026-10-28 00:08:19 +08:00
gloamxun e9bbd4bd87 Use Times metrics for ptm documents
Add a merged ptmr8t TFM asset, a TimesRoman paragraph face and Cmr10Metrics
entry, map a ptm Roman paragraph to it, and select the Liberation Serif
TrueType PDF backend for those projects. The title is uppercased rather than
small-capped so its widths use Times metrics.

The arXiv PDF now embeds Liberation Serif for body text; title/author/abstract
land at y=88/173/277pt with three pages and all references. Headings and bold/
italic Times faces still use CMR metrics.

Test count is 1075.
2026-10-28 00:00:34 +08:00
gloamxun 2ef5e29329 Embed raster images in the SVG preview
The SVG preview painted every DisplayItem::Image as a grey rectangle. Encode
the raw RGB image as a PNG (zlib via flate2, CRC32, base64) and emit an SVG
<image> data URI; keep the grey fallback for images above four megapixels.

The article preview now contains the real 480x240 plot and the framed rule
figure is visible while editing. Test count stays 1074.
2026-10-27 23:50:48 +08:00
gloamxun aa2f3cb0af Centre raster images inside floats
Add an x offset to VerticalItem::Image and use it when placing a decoded image
in a float, so a 0.4\textwidth plot is centred while its caption remains
centred across the float. Other image uses keep x=0.

Test count stays 1074.
2026-10-27 23:37:54 +08:00
gloamxun d00402a745 Use pixel dimensions for PDF image XObjects
The display-list conversion stored the layout width/height (scaled points)
as PdfImage.width/height, so an image XObject claimed 12 million pixels and
pdfimages reported bad image parameters; the image never appeared. Keep the
layout rectangle in DisplayItem::Image but use the raster pixel dimensions for
the XObject.

Verified pdfimages now lists the 480x240 plot and the article PDF shows it.
Test count stays 1074.
2026-10-27 23:30:26 +08:00
gloamxun b1e3e03f00 Fix the arXiv-template PDF output
The user-supplied template PDF exposed four concrete problems:

- title/headings were letter-spaced: plain text in a large paragraph took the
  SizedText segment path and was scaled twice; the fallback run now stays at
  the base size and is scaled once by the paragraph;
- the table lost its third column because unsupported math glyphs were sent
  through the PDF fallback font; table-cell math now has a readable ASCII
  fallback (Size (um), approx. 100, 10**6);
- fancyhdr's \cfoot{\thepage} was painted together with route-D's default page
  number; default numbering is skipped for a fancy pagestyle;
- .bib data was ignored; simple @article/@inproceedings entries are now parsed
  from project .bib files, inlined as thebibliography entries, and resolved by
  the existing citation pass, producing References and [1]-[3].

The regenerated 3-page PDF was checked for title/heading spacing, table text,
references and a single page number per page. A project regression test covers
the .bib path, and the table/heading fixes have unit tests.

Remaining visible limits in this template: the complex display equation, the
\fbox/rule figure body, vector/PDF images and the author block layout.
Test count moves to 1069 (444 core, 432 engine, 65 server).
2026-10-27 13:38:36 +08:00
gloamxun 88a03ec1a1 Scale inline math proportionally
Inline math in a 12pt paragraph kept 10pt glyphs because paint_math advances
with 10pt metrics. Paint the math atom into a temporary display list at the
10pt baseline and scale that list as a unit (text sizes and positions, rule
widths/heights, line endpoints) to the paragraph size before translating it to
the baseline. The box no longer pins its size, so a scaled math glyph now
reports font-size 12.000 in a 12pt paragraph.

The twelve-point test now also asserts that an italic math glyph is rendered at
the paragraph size; the sized-paragraph test still expects a math box and no
literal dollars.
2026-10-27 01:36:59 +08:00
gloamxun 47dcdfec47 Print tokens literally with string
\string<token> was unsupported, so documenting a control sequence expanded it
instead of printing it. The expand loop now reads the following token and emits
its characters without expansion; backslash and braces are replaced by
private-use placeholders that the renderer maps back to the real characters, so
the printed text cannot be re-tokenised and expanded by a later pass.

A preview test defines \foo, prints \string\foo, \string{ and \string}, and
checks the literal "\foo and { and }." with no expansion of \foo and no
warnings.
2026-10-27 01:16:30 +08:00
gloamxun 8ecbd5e720 Centre multirow cells over their rows 2026-10-26 20:31:03 +08:00
gloamxun aa072f58d8 Reserve outer tabcolsep margins around tables 2026-10-26 20:29:51 +08:00
gloamxun 0340878909 Pad color boxes by fboxsep 2026-10-26 04:11:42 +08:00
gloamxun 2018e5f8b8 Paint framed colorbox backgrounds 2026-10-26 03:08:37 +08:00
gloamxun d88e74cd29 Paint colorbox backgrounds 2026-10-26 03:05:07 +08:00
gloamxun 1ab2a29bfa Fill the page background with pagecolor 2026-10-26 02:31:50 +08:00
gloamxun 9ad404acee Paint textcolor runs in named colours 2026-10-26 01:41:00 +08:00
gloamxun 7ba66392ea Set operator names upright and declare new ones 2026-10-26 01:24:46 +08:00
gloamxun 8686b9a35e Stack substack rows with TeX inter-row gaps 2026-10-26 01:12:00 +08:00
gloamxun 569160f805 Check stacked limits against pdfLaTeX 2026-10-26 00:59:19 +08:00
gloamxun 52a74755f7 Check matrix and cases positions against pdfLaTeX 2026-10-26 00:53:40 +08:00
gloamxun 29d363d47a Set multline rows flush to the margins 2026-10-26 00:46:22 +08:00
gloamxun 59b6ca571b Lay out matrix and array environments as grids 2026-10-26 00:39:28 +08:00
gloamxun 971190df26 Report diagnostics and lay out cases environments 2026-10-26 00:35:08 +08:00
gloamxun 6d0794ef3a Paint vertical rules from table column separators 2026-10-25 02:29:23 +08:00
gloamxun 0b2265580f Raise and lower superscript and subscript runs 2026-10-25 02:14:51 +08:00
GloamXun 0f8aff7290 Embed project images in route-D previews and PDFs 2026-10-24 23:29:15 +08:00
gloamxun ae69eba64d Paint inline size changes at their own size 2026-10-24 23:22:29 +08:00
gloamxun b30bafca2b Annotate href links in route-D PDFs 2026-10-24 23:00:41 +08:00
gloamxun e008741aa5 Lay out inline math in paragraphs 2026-10-24 21:13:06 +08:00
gloamxun 9876895a84 Scale paragraphs by their declared base font size 2026-10-24 13:04:19 +08:00
gloamxun aa4d86d735 Distinguish slanted from italic and add italic typewriter
Add cmsl10/cmbxsl10/cmitt10 faces so \slshape and \textsl no longer reuse the italic cmti10 and \ttfamily\itshape reaches cmitt10. The NFSS state tracks italic, slanted and small caps separately, with last-shape-wins semantics for \em and the shape commands.
2026-10-24 12:58:41 +08:00