* .ai import: blank area type keeps its frame, blank point type quiet
A text object whose story is blank (nothing but spaces and line ends)
was never made (`Story::node`), so its slot
was left empty and counted in the note "text objects on hidden layers
or hidden objects couldn't be read", shown or not.
A slot of a blank story that neither the text document nor the page
fills is now settled after the page is matched, so the page's type
still takes it where the page has some for it alone:
- Blank area type and type on a path come in as a text object that
keeps its frame or path and draws nothing (`Story::blank_frame_node`),
as VectorCraft's Type tool keeps an empty frame (#85, #154). That
covers a frame the page's spare type went past (`Merged`) too. It is
kept without being weighed against the page, and so are the later
frames of its thread.
- Blank point type draws nothing and has nothing to keep, so it is left
out without a note, as the Type tool discards empty point type.
- A blank slot takes the page's type left over only when no other open
slot can (`readable_first`), so it no longer takes another object's
type by painting order.
- A blank story's thread isn't held against an unread object that takes
one of its frames, and a thread lists only the frames still there.
Its frames are still threaded type to warps and envelopes, which
never take the place of such a frame.
The note for text objects still left out no longer says they are
hidden: "text objects whose type couldn't be read from the file's text
document or its page are left out".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* .ai import: a blank frame an unread object leaves alone isn't threaded type
When an unread object takes one frame of a blank story's two-frame
thread with it, the other frame is no longer threaded in the document,
but warps and envelopes still treated it as threaded type and so never
weighed it against its look. They now get the frames of the threads
actually kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Test: the lone blank frame in a warp comes in as its look, no text left
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts in docs only (status lines, changelog rows and table rows):
main's entries and this branch's are both kept, each once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`token` on a string copied everything left in the string before scanning
one object, and `search` and `anchorsearch` copied both strings before
comparing them. A program that walks a string by what each call leaves
copied the rest of it on every call. All three now read the strings in
place and release the borrow before the scanned object is checked
against the budget and before the results are pushed. Results, errors
and the operations charged against the budget are the same as before.
Walking a 512 KiB string takes 16 ms instead of 518 ms with `token` and
1.0 ms instead of 27 ms with `search` (release build on Linux under load
from other builds, median of 7 alternating runs); on a 4 KiB string the
difference is under 0.1 ms.
Tests in tests_strings.rs compare each operator with the copying code on
the same operands (stack, error and operations left after every call),
check that the results see later writes to the string, and check that
no string is copied.
The writer kept every style text it checked, with its parse, until the
save ended, including texts the reader does not accept. A gradient style
placed on each object's outline is often a different text per object,
so memory grew with the number of objects checked.
The first 4,096 texts, up to 8 MiB of text, are kept parsed. Past that,
only the last text checked is kept, so the brush check that follows an
object's check reuses its parse, and other texts are parsed again when
checked. The written file is unchanged.
Saving a .ai file resolves the font of every run of type twice: once
for its font record and once to check that the font comes back as
itself. Each resolution looks the face up, reads its axes and name
table, and scans the loaded faces by PostScript name, so a document
with tens of thousands of runs in a few fonts repeated the same
lookups for every run.
The text document now keeps what each style's font fields (family,
style, version and Variable Font settings, each setting by the bits of
its value) resolve to for the whole save, and reuses it while the font
database's generation is unchanged. A font added or loaded during the
save resolves it again. The font set is still searched and filled as
before, so its order, indices and rollback are unchanged. The output
is unchanged.
- Tests: a save resolves as many fonts for one row of type as for
four; the program, header, warnings and private data are the same as
with every run's font resolved again (many fonts, threaded type,
envelopes of type, and type taken back when an envelope is written as
its art); each resolved record and check equals the uncached one for
static and variable fonts, settings outside the axis range, not a
number, +0 and -0, and a missing family, and a value resolved before
the font database changed is resolved again. An ignored test times
the save of 10,000 point type objects in three runs over four fonts.
A scatter brush takes a Hue Jitter amount from 0 to 180 degrees (0 by
default). Each copy turns the hue of its solid fills and strokes, type
included, by its own amount up to that far either way, after the
colorization. The amounts come from the stroke's path and the brush
name, so a stroke draws the same colors on every redraw, after Save and
Open, and in export. Copies keep their places, sizes and rotations.
A color turns in its own model (RGB in the HSB of its values, CMYK over
C, M and Y with K kept, Lab by turning a and b). White, black and grays
stay as they are, and a symbol instance in the art turns only its stain.
A brush at 0 draws its copies in the colors the colorization gives them
and saves no hue_jitter key; a brush without the key reads as 0.
- brush.options takes hue_jitter, and brush.get shows it for every
scatter brush. Brush Options shows a Hue Jitter field (ui.brushOptions
field hueJitter) with rows in every catalog.
- The .ai editing data writer does not write the amount, so a jittered
brush is left out of the Brushes panel there and reported, as other
brushes that would open with other settings are.
Docs: docs/mcp.md, docs/target-app-parity.md.
Saving a .ai file checks every art style it writes by reading it back
with the reader's style parser. Each object check parsed its style text
twice (once to read the appearance and once for the outline check), a
brushed style a third time, and a linked object first searched every
written style by name and copied its text. With thousands of objects
on a few styles, the same text was parsed tens of thousands of times.
The writer now keeps each style text's parse for the whole save, a
text the reader does not parse included, and reads it on each object:
the object's own gradient, the outline check, the brush check and the
appearance comparison still run per object. The own gradient is applied
to a copy of the parse, and that copy is the compared appearance; the
outline and brush checks read the kept parse.
Panel styles are found by their place in the written list. The output
is unchanged.
- import: parse_art_style, read_parsed_style and parsed_moves_with
split the parse from the reading; BrushesRead::style_reads takes the
parse.
- Tests: the parse count of a save does not grow with the number of
objects on the same styles; the program, header, warnings and private
data are the same as with a parse at every check; one parse read on
two objects gives each its own gradient. An ignored test times the
save of 40 graphic styles, 20,000 linked rectangles and 5,000 paths
with their own Outer Glow.
Each gradient fill or stroke, and each gradient swatch, looked for its
definition by comparing its gradient with every definition written so
far, and each new definition's name was checked against every other
name. A document with thousands of distinct gradients spent most of the
editing data's time in these comparisons.
The writer now keeps the definitions' names in a map and the
definitions no swatch names under a key made from every field of their
gradient (a zero of either sign giving the same key). Each candidate
under a key is still compared in full, the first in definition order
is used, and a style that isn't written frees the names and keys of
the definitions it added. Pattern definitions are found by name the
same way. The written program is unchanged, byte for byte.
When two stops share an end's offset, Level 2's stepped bands pad past
that end with the end stop's color and a Level 3 shading pads with the
color of the stretch next to it. The plate clip now decides whether the
padding is paper white by the color the painter in use draws, so a
paper-white padding no longer knocks out the ink below at Level 2, and
an inked one is no longer drawn over the ink below at Level 3 where the
shading pads with paper white.
A PostScript plate has no blending modes, so an overprinting gradient
whose stops mix zero and nonzero ink of a plate was drawn whole on it,
and its paper-white part knocked out the ink below.
On a plate, the EPS writer now clips an overprinting gradient to where
it puts the plate's ink down. Linear, radial and diamond gradients leave
out the stretches between paper-white stops and the padding past a
paper-white end stop. Conic gradients leave out their paper-white
wedges, and freeform gradients leave out their paper-white cells (masked
at Level 3, clipped at Level 2). Fills, strokes (within, along and
across) and characters are covered, on process and spot plates. Where
the gradient puts ink down it is drawn as before, and a gradient with
ink everywhere is written unchanged.
On PostScript plates, a stop or point of an overprinting gradient whose
color counts as black, with up to half a percent of another ink, now
puts none of that other ink down, as a solid fill of that color already
does. PDF plates are unchanged.
Texts::read copied the stories, the default styles, the paragraph
defaults and the frames out of the parsed text document and then
dropped the document. It now looks every required path up first,
reads the styles, Kinsoku sets and fonts from the whole document, and
then moves those four parts out. Every document that read before reads
to equal values, and every one that did not still does not.
Reading a synthetic editing copy with 2,000 point-type stories
(1.8 MB) takes a median of 60 ms of CPU time instead of 109 ms (7
alternating runs each, one process). The gain matters on documents
with a lot of type.
A Scatter or Art brush's art is read turned over, and the tiles of its
pattern fills now turn over with it, so they keep their place on the
art. The version 7 pattern test reads a Scatter brush's tile moves in
the file's own space (y up), as the art now is.
Scatter brush art is read turned over, as Art brush art is. The turn now
goes through the same helper as Art brushes, so the art of opacity masks
that don't move with their objects is turned over too and stays lined up
with the art. Fixes the "Unlinked spray" case of
scatter_and_art_brush_mask_art_round_trips.