Type on a path follows the path's tangent and grows by one scale, so a
frame matrix that stretches or slants it (for example 4 0 0 1) cannot be
kept: its glyphs came in twice as wide and twice as tall while the path
grew four times. Such a frame is now left to the page, as mirrored type
is. Turned and uniformly scaled frames are still made as type on a path.
A text frame's FrameMatrix was read only for point type. Area frames and
type on a path were built from the frame's segments as stored, without
the matrix, so area type turned a quarter opened unturned with its lines
across the page, and a turned path for type on a path opened unturned.
- The frame's segments are carried onto the canvas by its matrix for
every frame kind, and line starts use the first frame's matrix.
- Area type keeps the matrix's turn in its transform, with the frame in
the type's own space, so its lines run along the turned frame. A
scaled matrix scales the type, and a mirrored one is not made from the
text document, as for point type.
- The object's own path, which replaces the frame on import, is turned
back into the type's space before it becomes the frame.
- The file's first line is compared with the layout in the type's own
space.
measuring_data_too_large_to_hold_in_a_loop_runs_out_of_the_budget deflated
and measured 300 MiB of zeros against the 50,000,000-operation budget, and
took about 3.9 s. It now runs with the reader limited to 1 MiB
(with_data_limit), zeros that decompress to 4 MiB, and a budget of 524,288
operations for a file whatever its length (with_ops_limit, a test-only seam
for MAX_OPS like with_data_limit). It still checks that the data is
measured in full more than once and at most five times, and runs in about
0.09 s.
read_counting now reads on its thread with the calling thread's data and
operation limits, so tests that use it can lower them.
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.
- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
the_data_of_an_image_too_large_to_hold_is_skipped built 300 MiB of zeros
and Flate- and LZW-encoded each of them to get past the reader's 256 MiB
data limit, and took about 8.7 s.
Tests can now lower the limit on their own thread with
`with_data_limit`; shipped builds keep the 256 MiB constant. The test
runs under a 1 MiB limit with 2 MiB of data per filter, and checks that
the Flate and LZW data is measured in full, so it fails when the lower
limit does not take effect. It now takes about 0.14 s.
A star drawn with the Star tool, shape.star or addon.shapes.star was a
plain path, so its point count could not change after it was drawn.
- LiveShape::Star keeps the outer and inner radii, the point count
(2 to 1000, clamped when read from a file) and Live Corners' radii and
kinds. Its corners keep the radius they shared through a new count.
- object.setLiveShape takes `points` (2 to 1000) and `ratio` (inner
radius over outer radius, above 0 and up to 1), one undo step each and
none when nothing changes. A new layout drops the star's selected
anchors and segments; `points` with `radius` or `kind` is an error.
- The side widget shows on a live star and sets 3 to 20 points.
- Star Properties in the Transform panel and the Properties panel's
Transform section have a Points field with a 3 to 20 slider and a
Ratio field.
- Shape Tools' configure keeps a whole star live.
Fixes#4339
The test only checked that no warning mentioned limitcheck, so a
rangecheck or typecheck at the size limit would still pass. It now
checks that the import reports no error at all.
Four tests cover embedded-font code paths that no test reached:
- The Type 1 encrypted-part lexer steps over strings with escaped and
nested parentheses, nested procedures holding comments and strings,
comments, hexadecimal strings and dictionaries, and does not take
CharStrings written inside a string, a procedure or a comment for the
font's.
- A CIDFont's Metrics entries (a number, [sbx wx] and [sbx sby wx wy])
replace the glyph widths; an entry of another length keeps them.
- A GlyphDirectory array or dictionary draws the same glyphs as the
binary data section.
- A StartData count over 64 MiB is refused before it is read.
Adds tests for interpreter paths that no test reached:
- LZWDecode: the PDF 32000 example (a code that is the entry it adds),
12 KB of data whose table grows through 9- to 12-bit codes and is
cleared, and a code past the end of the table as an ioerror.
- An image too large to hold whose data is LZW or run-length: the data
is measured and skipped, and the art after it is read.
- clipsave and gsave keep up to 1,000 saved states; the next one is a
limit error.
- A sampled function may hold 4096 x 4096 samples and no more
(limitcheck on Size).
- currenthsbcolor when green or blue is the largest channel, and gray.
- cvs text of reals, booleans, names, operators and other objects, and
cvrs radix text with uppercase digits, negative numbers as 32-bit
two's complement, and a radix outside 2 to 36 refused.
No test failed when these writer paths broke:
- EPS export of an inside or outside stroke: the clip to the path (or,
even-odd, to everything outside it) before the stroke drawn at twice
its width.
- EPS export of a pattern stroke, written as its outline filled with the
tiles instead of as a stroke.
- The legacy .ai writer's live-object arm: a distorted image on a layer
is written as its pieces with the live-art warning.
- The .ai writer's top-object grid: the points inside the grid blended
from the four sides, checked on a 2 x 2 and a 3 x 2 outline so a
swapped row and column weight fails too.
Each test fails with the code it covers broken and passes with it
restored.
- The text engine reader reads dictionaries and lists nested 65 levels
deep and stops at a 66th, both balanced, so only the depth limit can
end the parse.
- A row of 256 mesh patches is stitched into one mesh, and a row of 257
is not.
- A variable library whose variableSets node writes its attributes and
children before its name is still read when reading stops before the
library: one variable and one data set with its text value.
Opening a PDF, EPS or .ai file with images re-encodes each image, and
each image's opacity mask, as a PNG. Since the switch to the shared
image codec these PNGs were written with the codec's default
compression (deflate level 6) instead of fast compression. A PDF and
an .ai file each holding one image opened about 50 ms and 105 ms
slower than in 0.24.1.
PDF import and the EPS and .ai readers now each encode through one
helper that asks for PngCompression::Fast, the setting the SVG filter
raster already uses. The pixels are unchanged.
Tests check the zlib header of every PNG an import stores (RFC 1950
FLEVEL): PDF RGB, gray and image-mask images and a CMYK image's soft
mask; a PostScript RGB image and a masked CMYK image's mask; and .ai
RGB and Separation images with their masks, at full size and reduced.
Assertions that ran all() over a list that could be empty now check the
list's length first: mesh points, image inks, glyph origins, imported
text, the PDF mesh and arrowhead paths, and the resampled CMYK pixels.
An image that takes a Warp from its art style is checked to keep none of
the look's fills and strokes, instead of checking each of none.
The convolve-matrix tests check that the filtered rectangle is imported,
not only that the import returned Ok. The fan-out clip path test moves
to a unit test that counts the clip paths read. The self-nesting symbol
test checks that the other symbol comes back. The EPS level and preview
id test checks the param values and the trimming and case rules instead
of looping over every value. The ignored PDF text-heavy timing run says
why it is ignored.
A gradient that repeats or reflects with no stops now paints as one
that pads. Before, PDF export wrote it as two 160 by 160 images and EPS
wrote three runs of a conic where one that pads writes one;
`Gradient::is_spread` is false without stops. `paint.setFill`'s params
still report the spread.
#9228 let a file with many text objects whose type is made be weighed by
where its pieces of type lie, up to four times the comparisons word
matching may make. The page's type lying where made type draws was still
searched word by word in every made text object there, and in the lines
of hidden made type, so those searches could run to the larger limit.
They are now counted on their own, up to MAX_PAIRS. Past it, type where
made type that shows draws is taken as that type, type over hidden made
type only stays on the page, and the page's type is noted as unchecked.
The letters of hidden made type's lines are worked out once.
Since #9228 hidden styled type whose look has its own transparency comes
in as a group of the look and the type, and the group holds the hidden
and locked state. A visibility variable bound to the type's XML id still
bound the type, so showing it left the type hidden. The reader now
records the text slot each such group wraps, and a visibility binding on
that slot binds the group; text bindings stay on the type.
A PDF part without layers comes in on one layer named for its page. When
the editing data is set aside (a stale copy of another page size, say),
pairing that layer with the editing data's one layer locked art nothing
ties to it. Layers now take locks only by a name unique on both sides.
The composite import test now checks the H's top and bottom as well as its
width and height, so a shift of the drawn glyph fails it. The mesh export test
samples each patch's center, so swapped column fills fail it.
The PDF, EPS, SVG mesh, metafile hatch and distorted-image tests now
assert the values the input gives: the Letter page a page without area
falls back to, the H glyph's box from its font metrics, the middle gray
of each mesh piece, the 8 of 64 hatch pixels, and the bounds of the
placement taken at the image's center.
A dynamic symbol instance keeps its appearance changes in the editing
data under each changed part's child index. The copy leaves out paths
and compound paths without anchors, so a change could reopen on a
different part or on none, and changes over 1 MiB were dropped with no
warning.
Such an instance is now written as its art, with the symbol-art
warning, when its changes take more than 1 MiB, when a left-out child
comes at or before a changed part's index in its group, or when the
symbol's root group is left with one kept child. Other instances stay
live with their changes.
Where the text document makes the type of every text object that shows,
each piece of the page's type is matched with the made type that holds
it, and a word of the piece is that type's when its spelling contains
the word. The page can draw two text objects as one word: a word and a
letter set apart from it (a swash "h" after "Spirit") come out of the
page as one piece, "Spirith". Both text objects hold the piece, but
neither spells the word, so it was counted as type with no text object,
with the note "some of the page's type has no text object in the
layers, so it is left out" (a loss, so `convert` wouldn't write over the
file), though both text objects come in and draw it.
A word still left is now the type of the text objects holding the piece
when it is the last word of one of them joined to the first word of
another that draws after it along the first one's lines. Each part is a
whole word of its text object, so bits of words don't make up a piece,
and the two the other way round don't make the word.
In our garment files (used locally, never committed) this takes the
note off one file of 424 and changes nothing else.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict in crates/eps/src/import/native/layers.rs: main reads the layers through read(), which adds the PDF part's font widths; the lazy lock snapshot of this branch is kept on top of it.
The reported file has 2106 text objects; its text document makes the type
of all but 5. The import still counted every text object against each of
the page's 2049 text objects (4.3 million pairs, past MAX_PAIRS), so it
fell back to the PDF part, which has no groups or names to carry locks.
Only the text objects whose type isn't made are matched with the page's
words. The made ones are weighed only by where they lie, a box against a
box, so they get their own limit, MAX_PLACE_PAIRS (4 x MAX_PAIRS). The
reported file now opens through its layers with its 20 locked objects
locked.
The fallback's lock snapshot is now read only when the PDF part is used,
and only when the layers could be read.
The regression builds its own editing data and PDF part with the reported
file's structure; nothing of the reported file is committed.
Main now reads the editing copy decoded as its streams are read
(#9922: ai_alone_decoded, ai_layers_alone_decoded, AiLayers::decoded)
and renamed the text document's patterns to paints (#9782:
text_patterns, Texts::with_paints). The decoded entry points take the
PDF part's widths as the ones they wrap did, AiLayers::decode goes
through AiLayers::decoded, and the text document still takes the widths
when it is first read, before its paints. The docs keep both sides'
entries.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A scatter brush takes a Brightness Jitter amount from 0 to 100 percent (0
by default). Each copy moves the brightness of its solid fills and
strokes, type included, by its own amount up to that many points either
way, after the colorization and the hue and saturation jitter. The
amounts come from the stroke's path and the brush name, drawn apart from
the hue and saturation jitter's, so a stroke draws the same colors on
every redraw, after Save and Open, and in export, and turning it on does
not change their amounts.
A color keeps its hue and saturation and moves in its own model: RGB in
the HSB of its values, Gray by its ink, Lab by its lightness with a and b
kept, and CMYK by its K over the brightness its C, M and Y leave. A CMYK
color that goes brighter than its C, M and Y show with no K loses its K
and takes less C, M and Y. The brightness stops at black and at full.
White, black and grays move too. A brush at 0 saves no brightness_jitter
key; a brush without the key reads as 0.
- brush.options takes brightness_jitter, and brush.get shows it for every
scatter brush. Brush Options shows a Brightness Jitter field
(ui.brushOptions field brightnessJitter).
- Options of Selected Object sets a path's own brightness_jitter
(brush.objectOptions).
- The brightness goes through the per-copy recolor step hue and
saturation jitter use, with its own salt.
- The .ai editing data writer does not write the amount, so such a brush
is left out of the Brushes panel there and reported.
Docs: docs/mcp.md, docs/target-app-parity.md.
The private data streams of a .ai file, or of a PDF saved with its
editing data, were joined into one buffer of at most 256 MiB before
they were decoded, while the decoded editing data may take up to an
eighth of installed memory (512 MiB to 2 GiB). A file whose streams
passed 256 MiB opened as its PDF part without a note, and a file whose
PDF part can't be read failed with "it is larger than 256 MB".
The streams are now read one after the other and decoded as they are
read, so they are never joined. The decoded data keeps its limit, and
no more of the streams is read than that limit and a sixteenth more.
The data is decompressed after the first compression marker in it.
A scatter brush takes a Saturation Jitter amount from 0 to 100 percent (0
by default). Each copy moves the saturation of its solid fills and
strokes, type included, by its own amount up to that many points either
way, after the colorization and the hue jitter. The amounts come from the
stroke's path and the brush name, drawn apart from the hue jitter's, so a
stroke draws the same colors on every redraw, after Save and Open, and in
export, and turning it on does not change the hue jitter's amounts.
A color keeps its hue and brightness and moves in its own model: RGB in
the HSB of its values, CMYK over C, M and Y with K kept, Lab by moving its
chroma with its lightness and hue angle kept (a and b stay within 127).
The saturation stops at none and at full. White, black and grays stay as
they are. A brush at 0 saves no saturation_jitter key; a brush without
the key reads as 0.
- brush.options takes saturation_jitter, and brush.get shows it for every
scatter brush. Brush Options shows a Saturation Jitter field
(ui.brushOptions field saturationJitter).
- Hue and saturation jitter share one per-copy recolor step, which takes
a salt and a color adjustment.
- Options of Selected Object showed Hue Jitter but dropped a change to it
on OK, since a path could not set it for itself. A path now sets its own
hue_jitter and saturation_jitter (brush.objectOptions).
- The .ai editing data writer does not write the amount, so such a brush
is left out of the Brushes panel there and reported.
Docs: docs/mcp.md, docs/target-app-parity.md.
Four EPS import tests asserted elapsed time (5 s, 20 s, a 20 s receive
timeout, and 1,000 copies against 5 times one copy). A busy test runner
could fail them, and a slower run that was still bounded could pass them.
Each now reads a test-only counter on its own thread:
- `]` without its `[`: the operand stack slots that `[` and `]` look at.
200,000 brackets look at no more than 4 slots each.
- The outline check: the point-to-segment distances it works out. A look
drawn 5,000 times works out no more than `MAX_OUTLINE_PAIRS`.
- Objects on a path: the paths and objects the records measure. A
thousand copies of a record measure as many as one copy.
- File fonts: the glyphs `fits` compares. A string of 250,000 of one
character makes fewer comparisons than it has glyphs.
Outside tests the counters do nothing.
Live envelopes, warped type and warped images were held to one shared
difference budget measured only on the first artboard. A file whose PDF
part shows a later artboard, a page cropped to the art, or more than one
artboard could then take more difference on that page than the page
check allows, and open from its PDF part instead of its layers.
Each page the art may be compared with (every artboard, and the art's
bounding box when it is not one of them) now has its own half share of
the page check's allowance. An envelope on a later artboard that draws
away from its drawn art over that artboard's page keeps its drawn art,
where before it opened live. Art on no such page is not held to a page.
Repeated pages are held once, the page list is worked out once per
change of artboards, and an import makes at most 1,024 comparisons with
pages; art that needs more keeps its drawn art.
A .ai file's editing data can include a placed EPS file's bytes between
%%BeginDocument: and %%EndDocument. The reader did not read those bytes:
in the %AI5_BeginPlace form the placed file showed only the preview the
data keeps of it, or an unread placeholder box without one, and in the
version 7 form the art the file draws came in as editable paths with a
note that placed files weren't read.
- The reader keeps those bytes (up to 256 MB) and makes the placed file a
placed document of them, in the file's bounding box where the
matrix puts it. It draws its art whether or not its file is found, and
a native save keeps the bytes. The version 7 form's placed EPS art is
no longer editable on open.
- A placed file stays as before when its bytes are a DCS file (File >
Place makes those linked images), have no bounding box of their own,
carry a VectorCraft document (as VectorCraft's EPS export writes),
don't read as an EPS file, or belong to a file named .ai or .ait.
What reading the bytes warns of is in the open result.
- One with a preview that an image variable binds stays the linked image
showing its preview, as a placed PDF page does.
- The link takes the size and hash of the bytes, so a file found unchanged
is neither missing nor modified.
- Drawing and the open check each read at most 8 placed EPS files inside
one another, so a file whose included files include others opens.
The open check draws the placed documents inside the bytes from their
previews, and it reads each included file once at each depth. A file
nested 12 levels deep opens with at most 8 drawing reads and 72
checks.
- File > Package with Copy Fonts reads the type of a placed EPS file, as
it reads a placed PDF page's, and of the EPS files it includes in turn,
pattern art included.
- On %_ lines the %_ that starts each line is taken off. Then one line
end is taken off the end of the bytes when another line end comes
before it: the one the %%BeginDocument: line ends with when the bytes
end with it, otherwise the last one. An LF after a CR is kept with it
when the file's first line ends with CRLF.
Docs: docs/target-app-parity.md.