Commit Graph
186 Commits
Author SHA1 Message Date
gloamxun d12c4b034b Share pdfTeX image and page object numbers 2026-11-27 15:54:24 +08:00
gloamxun 57a7097857 Restore PDF Forms from native formats 2026-11-27 15:31:24 +08:00
gloamxun c2d3312e5a Write native pdfTeX Form XObjects 2026-11-27 15:06:44 +08:00
gloamxun 7ff988031f Handle legacy XeTeX paper and landscape specials 2026-11-27 14:47:39 +08:00
gloamxun d944552188 Honor XeTeX page setup during native shipout 2026-11-27 14:38:19 +08:00
gloamxun 9da2ee41cd Restore XeTeX picture boxes at native shipout 2026-11-27 13:41:27 +08:00
gloamxun c2f18f50dc Restore registered pdfTeX images from native formats 2026-11-27 13:32:22 +08:00
gloamxun 140bb19849 Validate PDF page dependencies before reusing SVG previews 2026-11-26 18:36:10 +08:00
gloamxun facecbf790 Measure native XeTeX glyphs and break after mapped dashes 2026-11-21 12:58:25 +08:00
gloamxun c548ca8e9f Execute TECkit font mappings in native XeLaTeX jobs 2026-11-21 12:39:29 +08:00
gloamxun d17680fcd8 Execute Unicode math codes and measured OpenType math characters 2026-11-21 11:47:56 +08:00
gloamxun ce8a780031 Execute positioned TeX specials through native PDF devices 2026-11-21 11:24:46 +08:00
gloamxun 70822cbd94 Shape and render explicit OpenType fonts in native Unicode jobs 2026-11-21 10:35:03 +08:00
gloamxun 584b708487 Allocate dedicated PDF spaces in the native font catalog at shipout 2026-11-21 07:11:48 +08:00
gloamxun 3ff339341b Put native PDF warnings on separate diagnostic lines 2026-11-21 06:45:35 +08:00
gloamxun d02777a1fc Report active native math alignment and output lists 2026-11-21 06:26:49 +08:00
gloamxun 3ed2c2cd54 Print DVI dictionary warnings on their own TeX lines 2026-11-21 06:03:17 +08:00
gloamxun 1822ab2d32 Apply native automatic kerns and protrusion at real line edges 2026-11-21 06:00:55 +08:00
gloamxun 6675ab639a Redirect native TeX diagnostics to real output streams 2026-11-21 05:38:05 +08:00
gloamxun 003d5d8726 Resolve FitR destinations using shipped box geometry 2026-11-21 05:18:07 +08:00
gloamxun 22154b53a6 Resolve native PDF structure destinations and local actions 2026-11-21 05:04:54 +08:00
gloamxun e113033b8a Expand native PDF checksums over resolved input bytes 2026-11-21 04:41:46 +08:00
gloamxun 413939911f Save the TeX cursor in native shipout order 2026-11-21 04:27:06 +08:00
gloamxun 555a029505 Import PNG images in the native PDF device 2026-11-21 04:13:18 +08:00
gloamxun 7f74251c8a Track PDF literal transforms in native source maps 2026-11-21 02:23:12 +08:00
gloamxun 361e8d070f Reuse decoded Type 1 fonts across native revisions 2026-11-20 16:55:48 +08:00
gloamxun b5e87a8706 Stop obsolete draft rendering between pages 2026-11-19 17:28:55 +08:00
gloamxun eda01fb689 Show native preview during durable file publication 2026-11-19 17:19:11 +08:00
gloamxun 393fba42d8 Reuse closed events and line breaking after a checkpoint 2026-11-19 16:39:08 +08:00
gloamxun 5aa7dc7331 Stream native failure manifests during publication 2026-11-19 14:50:11 +08:00
gloamxun 72ed779749 Promote verified native PDF and box capacity support 2026-11-19 14:39:39 +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 1b0f4c8ab3 Append DOI fields to project bibliography entries
.format_bib_entry ignored the doi field, so the arXiv first reference lost its
doi:10.1109/... suffix. Append doi:<value> when present and extend the server
bib test fixture/assertions.

Test count stays 1078.
2026-10-28 00:54:05 +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 c2310d85ac Emit author-year labels for project BibTeX
The project .bib inliner now derives author-year labels (with a/b
disambiguation for duplicate author-years) and writes them as optional
\bibitem labels. The route-D citation pass uses those labels only when they
look like author-year labels: \citep gets parentheses, \citet becomes
Author (Year), and reference entries lose their numeric brackets. Inline
thebibliography entries without such labels remain numeric.

The arXiv sample now prints (Kour and Saabne, 2014a; Keshet et al., 2016) and
Kour and Saabne (2014b), matching natbib semantics more closely. Test count
stays 1073.
2026-10-27 23:07:00 +08:00
gloamxun c5bf150449 Draw the rule body of fbox figures
Parse the first non-zero \rule{width}{height} in a figure without a decoded
image and use it as the float dimensions, so the arXiv sample gets its black
rule body instead of a caption-only float. The fbox frame and vector images are
still unsupported.

This changes the arXiv corpus preview to 3 pages, matching TeX; update the
corpus expectation. Test count stays 1073.
2026-10-27 22:55:52 +08:00
gloamxun 9231c3a7d6 Return dirty-page preview patches
Project previews accept ?patch=1 and only include pages listed in changedPages.
Cache hits return an empty patch list. The web client applies sparse patches by
page index instead of rebuilding every page.

Add a two-page server test that edits only the second page and checks that the
patched payload contains exactly the changed page indices. Measure the arXiv
heading edit: 2 of 3 pages still changed (315 KB vs 396 KB full, 2.66 s), so
dirty-page transfer is in place but incremental layout latency is not.

Test count is 1073 (67 server).
2026-10-27 21:18:39 +08:00
gloamxun e2e80e8728 Compile editor buffers without waiting for a save
Project preview accepts ?buffer=1 and reads the editor text from the POST body.
The source is still expanded with project includes/packages/images, but the file
on disk is not touched, so typing can drive layout immediately while the normal
450 ms save timer runs independently.

Add a server test that previews buffer text, finds it in the SVG, and verifies
hello.tex on disk was not rewritten. Roadmap notes that warm buffer previews
are still ~430 ms (article) and ~2.1 s (arXiv), and that dirty-page streaming
is the next latency step.
2026-10-27 21:01:24 +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 1058122388 Add route-D web contract and experiment matrix
Route-D preview JSON now reports durationMs on the flat, project and edit
paths, and project preview/PDF responses carry X-Preview-Engine (route-d or
v1), including cache hits and silent fallback. The server tests assert the
headers, the duration field and both PDF engines.

docs/WEB_ROUTE_D_EXPERIMENT.md records the audit verdict, the initial contract
probe, the supported/gap matrix, the three-project trial plan and the
prioritised backlog; ROUTE_D_STATUS.md links to it and the test counts move to
1063.
2026-10-27 12:23:04 +08:00
gloamxun e8f7e37cf7 Pin the corpus page counts
The corpus guard only checked that each document produced at least one page.
It now asserts the exact counts (hello 1, boxes 1, compat 1, arXiv template 2)
alongside the empty warnings array, so a layout regression that drops or adds a
page fails the server test even when no warning is emitted.

The status document's verification paragraph mentions the exact-count check.
2026-10-27 03:02:30 +08:00
gloamxun 28aed153fe Guard corpus previews against warnings
The warning-free corpus sweep was only a manual check. Add a server test that
previews examples/hello.tex, boxes.tex, compat.tex and the arXiv template
through /api/route-d/preview and asserts each returns 200, at least one page
and an empty warnings array, so the corpus guard runs with the normal suite.
2026-10-27 01:39:32 +08:00
gloamxun 371f05baaa Default project previews and PDFs to route-D
uses_route_d still treated v1 as the default unless TEXRRA_ENGINE=route-d was
set, so only the flat /preview endpoint had switched. Make route-D the default
there too: an explicit engine parameter still wins, TEXRRA_ENGINE=v1 forces the
old pipeline, and a route-D error now falls through to the v1 compiler instead
of answering 422 (both preview and PDF).

Because route-D follows pdfLaTeX's Letter default for geometry-less documents,
the two server tests that asserted the v1 A4 page now ask for ?engine=v1 or
expect 215.9mm. A new test starts a server without the environment variable and
checks a project preview uses route-D's italic math face with no literal $.
2026-10-27 00:32:45 +08:00
gloamxun a56d441513 Make route-D the default flat preview engine
POST /preview served the v1 pipeline while route-D lived behind /api/route-d
and the project engine switch. Try route_d::preview_json first and keep the v1
compiler as the fallback when route-D rejects the source; ?engine=v1 forces the
old path and the project endpoints are unchanged.

Both paths now answer with an X-Preview-Engine header (route-d or v1) so the
choice is observable, and the server test helper compares header names
case-insensitively because tiny-http lowercases them.

A server test posts a document and checks route-d by default plus v1 when the
query asks for it.
2026-10-27 00:27:59 +08:00
gloamxun 1bb28cf141 Skip the SIVP test when its project fixture is absent
projects/ is gitignored, so a fresh clone has no projects/_sivp__/sn-article.tex. Return early like the neighbouring front-matter test instead of panicking on the missing file.
2026-10-26 22:03:25 +08:00
gloamxun 1d891b2c6a Verify test server identity before accepting it 2026-10-26 20:34:20 +08:00
gloamxun 090f389589 Reject test servers that exit after a port race 2026-10-26 04:26:17 +08:00
gloamxun 697d84aab3 Cover FIFO eviction in the flat route-D caches 2026-10-25 01:58:23 +08:00
gloamxun 0a91f7e9db Exercise PDF cache concurrency and retry test requests 2026-10-25 01:56:37 +08:00