vectorcraft/crates/pdf/src
bflatastic 9f3b992ecc EPS import: other apps' EPS open as vectors, a preview that stands in says why
Discord feedback: "EPS files are always rasterized: they open as bitmaps, in
other programs as vectors". Every EPS saved by Illustrator 2026 fell back to
its TIFF preview (`gcheck` was unknown), and cairo/Inkscape files stopped at
their first image (`status`), dropped masked images (ImageType 3) and failed
on mesh gradients; the warning didn't say where the program failed.

Fallback never silent:
- The warning names the PostScript error, the operator that raised it and
  the named procedures it ran in, innermost first ("a PostScript error
  (typecheck in `add`), in `inner` in `outer`"); errors caught by `stopped`
  aren't reported. It reaches the status bar, document.open, app.open and
  file.open (which now return document.open's result, so MCP's open_file over
  the control channel gets it), and `vectorcraft-cli info` ("warnings").
- A file whose PostScript can't be read opens as its TIFF preview, else its
  Windows metafile preview (as vectors, scaled to the bounding box), else its
  EPSI bitmap. es @msg rows for the new messages.

Interpreter:
- Operators programs probe or use: gcheck/scheck, rootfont,
  currentcolorrendering, currenthsbcolor, status, token, read,
  bytesavailable, fileposition/setfileposition, resetfile, write*, pdfmark
  (marks dropped, as Ghostscript does), execform, nulldevice, strokepath,
  pathforall, user paths (ufill/ueofill/ustroke/uappend/upath/setbbox, the
  encoded form too), setcachedevice2, findcolorrendering, cache, device and
  VM queries, revision; (%stdout) (w) file gives a sink.
- `//name` is replaced by its value when read, inside procedures too.
- Tiling patterns become pattern swatches (their PaintProc drawn in pattern
  space, one cell; uncoloured ones in the colour under them; makepattern
  copies share one swatch); nested patterns stop at 8 levels.
- Type 3 fonts draw their glyphs (BuildGlyph/BuildChar, widths from
  setcachedevice/setcharwidth) as outlines grouped per string, spaced by
  ashow/widthshow/awidthshow/xshow/yshow/xyshow/kshow; glyphshow and
  stringwidth/cshow use them.
- Shadings of types 1 and 4-7 become gradient meshes (data from arrays,
  strings or files, packed or not, flags sharing edges), as fills through a
  shading pattern too; sampled functions (type 0) are evaluated;
  GradientMesh::coons/triangle are shared with PDF import.
- ImageType 3 masked images, interleaved by sample, by row or in separate
  sources; ReusableStreamDecode reads its data when made; Flate/LZW PNG and
  TIFF predictors.
- Bounded: DeviceN at 32 inks, sampled functions at 2^24 samples and 32
  outputs, 4096 patches a shading, strokepath ignores dashes finer than 1e5
  pieces, Type 3 glyphs nest 8 deep (a glyph that shows itself overflowed the
  stack before the limit), 64-bit index maths for 32-bit targets.

Tests: a synthetic program per generator (cairo/Inkscape, its Type 3 fonts,
matplotlib, CorelDRAW, Affinity, LibreOffice, Ghostscript eps2write,
Illustrator procsets), meshes and function shadings, masked images, fault
messages, probing operators, metafile/EPSI previews, `//name`, user paths,
hostile patterns/glyphs/shadings (run against main, 12 of the 14 generator
and feature tests fail; CorelDRAW- and LibreOffice-style programs already
read there). The import fuzz vocabulary covers the new operators. Checked
against real files made here with Inkscape 1.4 (cairo) and Illustrator 2026
(its own format and the CS-to-CC compatibility formats; all fell back or
stopped early on main and open as vectors now; its Illustrator 8 format
needs the next commit); those files aren't committed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 18:23:36 +07:00
..
print M4.83: overprinting fills and strokes overprint in PDF 2026-10-05 17:39:28 +07:00
editing.rs M4.85: PDF security: encryption at every compatibility level, permissions, either password opens 2026-10-05 15:24:16 +07:00
encrypt.rs Lint: as_chunks for constant chunk sizes, as clippy 1.99 asks 2026-10-05 12:14:56 -07:00
export.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
forms.rs M4.83: overprinting fills and strokes overprint in PDF 2026-10-05 17:39:28 +07:00
images.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
import.rs Part of #472: Escape leaves Presentation Mode; dropped documents open as tabs; .ai off-artboard note 2026-10-08 18:01:12 +07:00
import_color.rs M4.46: PDF import keeps CMYK, Gray and spot colours 2026-10-05 09:37:11 +07:00
import_image.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
import_mask.rs Fix #334: .ai import leaves out the white page under the layers 2026-10-08 06:03:45 +07:00
import_scan.rs Fix #419: PDF/.ai art past the layer scan's limit never shows a hidden layer 2026-10-08 10:30:07 +07:00
import_shading.rs EPS import: other apps' EPS open as vectors, a preview that stands in says why 2026-10-08 18:23:36 +07:00
import_text.rs Fix #429: Type on a path brackets, flip and Type on a Path Options that keep the type in place 2026-10-08 12:50:25 +07:00
lab_spot.rs M4.73: PDF colour conversion, ICC profiles and output intent 2026-10-05 16:25:20 +07:00
lib.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
linearize.rs M4.86: PDF page thumbnails and fast web view (linearised files) 2026-10-05 18:05:36 +07:00
marks.rs M4.75: File → Print writes the job as a print-ready PDF: paper, scale, tiles, marks and bleed, separations 2026-10-05 15:13:10 +07:00
output.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
pages.rs M4.85: PDF security: encryption at every compatibility level, permissions, either password opens 2026-10-05 15:24:16 +07:00
patch.rs M4.86: PDF page thumbnails and fast web view (linearised files) 2026-10-05 18:05:36 +07:00
pdfx.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
post.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
presets.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
settings.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
syntax.rs M4.86: PDF page thumbnails and fast web view (linearised files) 2026-10-05 18:05:36 +07:00
tests.rs Part of #472: Escape leaves Presentation Mode; dropped documents open as tabs; .ai off-artboard note 2026-10-08 18:01:12 +07:00
tests_blend.rs M4.31: Save PDF dialog and document.exportPdf with PDF settings 2026-10-05 07:22:27 +07:00
tests_charstroke.rs M3.40: stroke on type — the Stroke panel edits the characters' stroke 2026-10-05 01:09:55 +07:00
tests_cmykblend.rs M4.31: Save PDF dialog and document.exportPdf with PDF settings 2026-10-05 07:22:27 +07:00
tests_cmykimages.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
tests_compression.rs M4.63: Links panel with status, Relink, Go To, Update, Edit Original, Embed/Unembed, Link Info and Placement Options 2026-10-05 12:40:05 +07:00
tests_dashalign.rs M3.68: groups, layers and type have their own fills, strokes and effects, with Contents and Characters rows 2026-10-05 00:59:34 +07:00
tests_editing.rs M4.43: PDFs and .ai files reopen editable; Save As writes PDF-compatible .ai 2026-10-05 10:34:15 +07:00
tests_encrypt.rs M4.84: PDF/X-1a, PDF/X-3 and PDF/X-4 files written as their standards say 2026-10-05 17:19:11 +07:00
tests_focal.rs M3.98: radial annotator extent ellipse, aspect handle and off-centre focal point 2026-10-05 04:43:43 +07:00
tests_fx.rs M3.43: effects render on type, placed images, symbol instances, blends, envelopes, meshes and repeats; a fill or stroke's own raster effects render and export as SVG filters on that element 2026-10-04 23:15:13 +07:00
tests_import_color.rs M4.46: PDF import keeps CMYK, Gray and spot colours 2026-10-05 09:37:11 +07:00
tests_import_fidelity.rs Part of #372: PDF/.ai import keeps strokes live and hidden and nested layers 2026-10-08 06:55:51 +07:00
tests_import_layers.rs Part of #472: Escape leaves Presentation Mode; dropped documents open as tabs; .ai off-artboard note 2026-10-08 18:01:12 +07:00
tests_import_options.rs PDF/.ai import: art of a neighbouring artboard stays on its own page 2026-10-07 13:20:07 +07:00
tests_layers.rs M4.83: overprinting fills and strokes overprint in PDF 2026-10-05 17:39:28 +07:00
tests_live_text.rs Fix #319: exports warn when type in a missing font is written in the fallback font 2026-10-08 06:04:29 +07:00
tests_marks.rs M4.72: PDF export draws printer's marks in Registration around each page 2026-10-05 13:05:20 +07:00
tests_output.rs Fix #320: CMYK images stay CMYK from PDF import to PDF export 2026-10-08 06:04:07 +07:00
tests_pdf13.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
tests_pdfx.rs M4.84: PDF/X-1a, PDF/X-3 and PDF/X-4 files written as their standards say 2026-10-05 17:19:11 +07:00
tests_presets.rs M4.84: PDF/X-1a, PDF/X-3 and PDF/X-4 files written as their standards say 2026-10-05 17:19:11 +07:00
tests_print.rs M4.75: File → Print writes the job as a print-ready PDF: paper, scale, tiles, marks and bleed, separations 2026-10-05 15:13:10 +07:00
tests_printadvanced.rs M4.83: overprinting fills and strokes overprint in PDF 2026-10-05 17:39:28 +07:00
tests_realtext.rs Fix #429: Type on a path brackets, flip and Type on a Path Options that keep the type in place 2026-10-08 12:50:25 +07:00
tests_settings.rs M4.87: PDF 1.3 compatibility: transparency flattened with the chosen preset 2026-10-05 18:05:36 +07:00
tests_stroke.rs M3.68: groups, layers and type have their own fills, strokes and effects, with Contents and Characters rows 2026-10-05 00:59:34 +07:00
tests_strokeout.rs M3.68: groups, layers and type have their own fills, strokes and effects, with Contents and Characters rows 2026-10-05 00:59:34 +07:00
tests_textstroke.rs M4.59: pattern strokes and freeform gradients keep their look in PDF 2026-10-05 11:52:35 +07:00
tests_webview.rs M4.86: PDF page thumbnails and fast web view (linearised files) 2026-10-05 18:05:36 +07:00