Repository navigation
Fix #861: open .ai files whose non-native art has ASCII85 lines starting with %_ - #854
Conversation
|
Thanks again, @rschuerer! This is a neat find: an ASCII85 line that happens to start with |
A letterhead saved by Illustrator 28 without PDF compatibility wouldn't open: "its editing data can't be read (it ends inside a layer)". Its layer starts with a /ForeignObject (non-native art: the content of a placed PDF), whose /Data entry is the PDF as ASCII85 in comment lines. ASCII85 includes `_`, so about one line in 85 starts with `%_`, which the lexer reads as hidden tokens; a `(` in such a line opened a string that swallowed the dictionary's end, the rest of the art and the layer's LB. The reader now skips to the data's `~>` after `/Data ,` in a /ForeignObject, as it already did for a /Binary dictionary's ASCII85, and leaves the non-native art out with a note (nothing draws its PDF from the editing data yet). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ZwZjADUZP4VzvrFGpiZch
424bf6c to
f2ba41d
Compare
|
Merged, thanks @rschuerer! Tracking a file that "ends inside a layer" down to an ASCII85 line that happens to start with I rebased it onto current |
Fixes #861.
A
.aisaved by Illustrator 28 without PDF compatibility wouldn't open: "this file was saved without PDF compatibility, and its editing data can't be read (it ends inside a layer)".Commit 1: open the file
Its layer starts with a
/ForeignObject(non-native art: the content of a placed PDF), whose/Dataentry is that PDF as ASCII85 in%comment lines. ASCII85 includes_, so about one line in 85 starts with%_, which the lexer reads as hidden tokens; a(in such a line opened a string that swallowed the dictionary's;, the rest of the art and the layer'sLB. The reader now reads that data as a whole, up to its~>, as it already did for a/Binarydictionary's ASCII85.Commit 2: draw the non-native art
The letterhead's main graphic, a fan of swooshes, is exactly that object: a radial gradient in a 3-point PDF, scaled 271 times and clipped by the swoosh paths. Leaving it out opened a page without its graphic.
The reader now decodes the PDF, has the PDF importer read it, and fits its art to the object's box as a group named "Non-native art". The box is
/Boundsmeasured from/Originwith y down, then/RTransform; on both objects of that file it lands exactly on the clipping paths around them. The PDF's content keeps its own y-up coordinates, so it is flipped into the box (verified against the original: the gradient fades from the apex at the top right). Ids are the document's, the PDF's swatches stay unlinked, its images join by content key. A PDF that can't be read is left out with a note.The EPS crate now uses the PDF crate, both layer 3;
xtask layersallows it like render and metafile.Tests: a data line starting with
%_(that isn't a PDF (opens, note), and a real tiny PDF with two squares fitted to the box, checking placement, orientation, colours and ids.docs/mcp.mdupdated.cargo xtask cipasses.Not in this PR: showing a failed open's error in the window (noted in #861).
🤖 Generated with Claude Code
https://claude.ai/code/session_017ZwZjADUZP4VzvrFGpiZch