Commit Graph
20 Commits
Author SHA1 Message Date
41fb227542 feat(ps): add bounded shared PostScript EPS reader (#1276)
* feat(ps): add craft-ps with an EPS reader (read feature)

The reading half of craft-ps (#115): a clean-room PostScript interpreter
that runs an EPS and returns what it paints as a one-page vector PDF of
its bounding box, colours kept, so apps can draw and export EPS as a
placed PDF. Moved from DesignCraft (storytold/designcraft, where it was
written for placed EPS), with its app-specific names made neutral.

Written from the PostScript Language Reference (3rd ed.), the EPS
specification, the Type 1 Font Format and Adobe TN 5012/5176/5177.
Covers the language, paths, clipping, strokepath, device/Separation/
DeviceN/Indexed/ICCBased/Lab colour, images with lazily decoded filters,
shadings 1-7 and patterns, and Type 1/3/42/CFF/CID text through CMaps,
horizontal and vertical.

Bounded: each operator charges work proportional to its operands
against the step limit as it goes, every byte read or decoded counts,
copies count against the memory cap; defaults 50 M steps / 1 GiB, and
20 M / 256 MiB on wasm32. No panics (deny lints, fuzzed in debug
builds). 34 tests, the Type 42 one on a TrueType font built in the
test. No new external crates: pdf-writer, miniz_oxide, weezl, skrifa
and kurbo are already locked at these versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* clippy(ps): document stateful decoder complexity

* fix(ps): bound huge arc angle normalization

* fix(ps): preserve EffectCraft EPS text and limits parity

* fix(ps): address interpreter review findings

* fix(ps): preserve composite glyph paint order

* fix(ps): address interpreter review findings

* fix(ps): bound filter buffers and preserve file aliases

* fix(ps): make predictor allocation fallible

---------

Co-authored-by: markus.doebele <markus.doebele@top21.sh>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 06:10:27 -05:00
Dylan M. Taylor 964ccae812 craft-eps: share PostScript numeric operators 2026-11-14 02:26:40 +00:00
Dylan M. Taylor 39f45eda55 Avoid ambiguous empty stack assertions 2026-11-14 00:48:11 +00:00
Dylan M. Taylor 26feec69cb Add reusable PostScript VM stack operators 2026-11-14 00:37:04 +00:00
Dylan M. Taylor 6eac66c1fe Merge remote-tracking branch 'origin/main' into codex/eps-postscript-vm 2026-11-13 23:20:31 +00:00
Dylan M. Taylor a9080bf1fd Merge remote-tracking branch 'origin/main' into codex/eps-postscript-api 2026-11-13 22:16:25 +00:00
Dylan M. Taylor d62c51645e Add bounded PostScript VM primitives 2026-11-13 21:59:03 +00:00
Dylan M. Taylor ab51daff1a Respect PostScript delimiters after literal names 2026-11-13 21:29:53 +00:00
Dylan M. Taylor 4cc86fc7cf Add reusable PostScript EPS scanner 2026-11-13 21:21:47 +00:00
Dylan M. Taylor 24a011ae59 Fix lexical EPS embedded font scanning 2026-11-13 21:17:24 +00:00
Dylan M. Taylor 46478f4cf2 Extract embedded PostScript font scanning to craft-eps 2026-11-13 18:42:48 +00:00
Dylan M. Taylor b5dfdb0bda Fix shared file import edge cases 2026-11-13 07:50:09 -05:00
Dylan M. Taylor 59c52ac1dc Merge pull request #1174 from dylanmtaylor/codex/vector-file-imports
Add shared vector path import APIs
2026-11-13 07:35:46 -05:00
Dylan M. Taylor 4546555126 Fix bounds and limits in shared vector readers 2026-11-13 05:42:34 -05:00
Dylan M. Taylor 7fbe3837bc Fix EPS path bounds variable 2026-11-13 03:58:22 -05:00
Dylan M. Taylor e3d76471f6 Fix vector import edge cases from review 2026-11-13 03:58:22 -05:00
Dylan M. Taylor f80d86172b Expose PostScript page bounds in path imports 2026-11-13 03:58:22 -05:00
Dylan M. Taylor b373553e98 Add shared vector path import APIs 2026-11-13 03:58:21 -05:00
Dylan M. Taylor ba24fe2435 Move bounded EPS rectangle parsing to craft-eps 2026-11-13 00:39:37 -05:00
Dylan M. Taylor f2d658d08f craft-eps: EPS files as a container (binary header, DSC comments, EPSI preview, ASCII85, sniffing) (#909)
The layer every EPS reader and writer in the apps had its own copy of: where the PostScript
and the previews are behind the binary header (read and write), the header comments with
the bounding boxes (also deferred to the trailer), the EPSI preview bitmap, ASCII85 both
ways, and telling EPS, PostScript and PostScript- or PDF-based Illustrator files apart.
No PostScript interpreter.

From storytold/vectorcraft at 6e873b80 (crates/eps: lib.rs, import.rs, import/preview.rs,
ps.rs) and storytold/designcraft at 513f77b8 (crates/images/src/eps.rs).
2026-11-11 18:39:42 -05:00