Thanks @el-j — merging.
**Summary:** Pathfinder Trim/Crop (and Merge) now build on `each_classified_face` (generalizing `each_face`) so classification and face construction share one batched pass, dropping the duplicate `batched_classified_contours` after #4375 as @bflatastic asked. Differential tests lock subpath order and the fully-covered shape case.
Floating panels are OS windows of their own, and craft-ui keeps a palette above the
app's other windows while it is active. A modal dialog or an open menu is drawn in
the main window, so a floating panel covered it: the Colour Picker's OK button and
fields, Recolor Artwork, and the menu bar's drop-downs (#5238, defect 1).
While a modal dialog or a menu of the in-window menu bar is open the docking renderer
hides each palette window, and when neither is open each palette shows again at its
palette level: topmost while the app is active, behind other applications' windows
while it is not, as craft-ui leaves a palette it creates. Hiding rather than lowering
covers both: a lowered window can be clicked back to the front, and craft-ui varies
the level through the viewport builder, which egui applies when the window opens and
not to one already on screen, so the commands go explicitly to the windows there are.
The menu bar tells the docking renderer whether one of its top-level menus is open,
the same state its hover switching uses; egui's own "any popup open" misses the
in-window menu bar.
Measured on Windows with the app focused and panels floating: before, a palette was at
the front of the z-order and topmost over the main window with the Colour Picker open;
after, the main window is in front and the palette is hidden until the dialog or menu
closes.
Tests: a_modal_lowers_the_native_palette_windows and
a_menu_of_the_menu_bar_lowers_the_palette_windows check the commands sent, and
a_palette_window_keeps_out_of_the_way_of_the_main_windows_dialog_and_menus the level
and visibility table. The wheel test
`wheel_over_a_floating_character_font_field_changes_the_font` fails on this machine
without this change too (font-order dependent), so it is not part of it.
Each gradient definition that no swatch names took its name by trying
`Gradient`, `Gradient 2`, `Gradient 3`, ... from the start, so a document
with many such gradients tried every earlier name again for each new
one. The writer now keeps the number the next search starts from, and
still skips names that a gradient, swatch or pattern already has.
- A test names 1,000 gradients around two taken names and checks that
each name is tried once (1,002 tries; 502,496 when each search starts
over).
- An export test writes 300 gradients next to a `Gradient 3` swatch and
a `Gradient 7` pattern, and checks the names in order and the same
output when written again. It passes with the old search too.
The editing copy of a PDF-compatible .ai wrote every image as its outline
filled with its average color. Embedded images are now written with their
pixels, and linked images as placed files with a preview:
- Embedded images are rasters in the form of the version 7 specification
(section 8, https://13thmonkey.org/documentation/fonts/AI7FileFormat.pdf):
%AI5_BeginRaster, the color space, the image matrix and the XI operands
of current files, then the samples in binary in a %%BeginData section.
Gray, RGB and CMYK images keep their samples (CMYK images their ink
amounts), and see-through images their alpha channel after the color
samples. The matrix is written to ten decimals.
- Linked images are placed files (section 16): the matrix, the box of the
file's pixels and its path, %%IncludeFile, the folder relative to the
document's (when the relative path ends in the path's file name), and a
preview of at most 256 pixels a side.
- Images that can't be decoded or have more than 33,554,432 pixels (the
most the reader reads) are written as their outlines filled mid gray,
images of 16 bits a channel (CMYK TIFFs included) at 8 bits, and linked
images in opacity masks and pattern tiles as embedded images, each with
a warning.
Each of these is written in the form VectorCraft's .ai reader reads, and
the tests read the written data back through that reader.
The reader now gives an image its name and opacity mask when the
operators that end its raster (XH, Xr and the N after %AI5_EndRaster) come
before its dictionary, reads an empty relative folder as the document's
own folder, and looks for the %%EndData that ends an image's samples
after the alpha channel its XI operands give it, preferring one whose next
line is XH, so samples that hold the marker's bytes are read whole.
Tests: the round trip of every kind of image and its state, a second write
of what is read back giving the same bytes, the raster and placed-file
forms, previews of large linked images, and the engine's editing copy with
every save option; a fuzz case for damaged images and placed files.
Docs: docs/file-format-parity.md.
In the legacy format, area type whose story flows through several linked
areas has one text path (`Tp` ... `TP`) for each area, each with its own
matrix and frame (version 7 specification, sections 15 and 15.5.3). The
reader kept only the first frame, placed it with the text object's last
valid matrix, and put the whole story in that one frame.
Each linked area with a frame now opens as its own area type object,
placed with its own matrix, and the frames are threaded in file order.
The first frame holds the story: the characters after every `TP`, and
the overflow text. When the file opens, the story is laid out again
through the thread (section 15.1 lists the flow from area to area as
final-form information). A linked area without a frame is left out.
Area type with one area opens as before.
The dictionary that follows a text object (its opacity mask, text wrap,
name and other keys) went to its one object. Its opacity mask and text
wrap now go on every frame, and its other keys on the first frame.
Point type is read with its first text path's matrix, and type on a
path with the matrix and start of the first text path that has a path.
Area type with no frame at all opens as point type with its first text
path's matrix. Before, these used the last valid matrix and, for type
on a path, the last start.
One text object reads at most 4,096 text paths. The number of frames
times the story's character count is kept to 4,194,304, so a longer
story keeps fewer frames. Frames past either limit are left out, with a
warning.
A ui.pointer request made before synthetic input was dropped counted
toward the per-frame request limit even when its caller had already
given it up and no reply was sent. A backlog of such requests could hold
live requests back for a frame. It now counts only when the app claims
it and replies with the error, as the other given-up requests are
skipped.
A legacy .ai in the version 7 form names a linked image's file with
`(path) modified XG` and draws the image with `XF`, which takes the
operands `XI` takes and has no samples after it (Adobe Illustrator File
Format Specification 7.0, sections 8.2 and 8.3). The reader ignored both
operators, so the image was dropped without a warning.
- `XF` after `XG` becomes a linked image of that file, its pixels placed
as an `XI` image of the same operands is placed. The file keeps no
pixels of it, so a placeholder stands in until the file is relinked in
the Links panel, with a note in the open result. No pixels are read,
so the image is not held to the pixel limit of `XI`'s samples.
- An `XF` without a file name before it, or with operands `XI` couldn't
read (no matrix, too few numbers, no pixels, or samples of other than
1 or 8 bits), is left out with the existing "an image VectorCraft
can't read was left out" warning. An `XG` applies only to the image
after it in the same raster object; `() 1 XG` before an embedded `XI`
keeps that image embedded.
- A PostScript page draws nothing for `XF`, so there the placeholder's
area is left out of the comparison of the layers with the page, and
the file keeps its layers. A PDF part draws the image's pixels, so a
file with one is compared with it there as before, and its layers are
not used without the PDF part.
- Linked images of different files get image keys of their own even
when they show the same pixels (the placeholder, or two identical
placed-file previews), so updating or exporting one file's image
reads that file only.
- `vectorcraft_doc::links::missing_placeholder` draws the placeholder: a
light tile, crossed out, as SVG import shows for a missing file.
Tests: reader tests for the placement, the image keys and the cases left
out, an end-to-end test of a legacy file with a linked image, a test of
a file with a PDF part, and a fuzz case for damaged files with `XG` and
`XF`. The new note has a row in each catalog that translates the
placed-file note.
First slice of https://github.com/storytold/vectorcraft/pull/1281, split
as the review asked. `--deep` gains rows for hovering, a hit test that
misses, marquee, smart guide targets and shift-click on a large document,
so the later slices have a baseline.
PathData::bounds built a kurbo path on every call. It now measures the
segments in place, with the same guards, and a proptest compares the
result bit for bit with what the path gave.
Co-Authored-By: arhammusheer <arhammusheer@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Type in the text document of a .ai or EPS file's editing data that names
no character or paragraph style, a story without style runs included, is
set in [Normal Character Style] and [Normal Paragraph Style]. The reader
took what such type leaves out from the text document's base attributes
instead, or built-in defaults for a story without paragraph runs, and it
did not read paragraph styles.
A Large Canvas file (1:10) holds the normal styles' lengths at the art's
scale (1.2 for 12 pt) and the base attributes' at the page's (12). The
reader scaled the base attributes' 12 by 10, so the type came in at
120 pt. In an EPS the page comparison then rejected the layers, and the
file opened as its printed page without its linked images.
In any file whose normal styles differ from the base attributes, such
type now takes what the normal styles set, such as font, size, colors,
stroke, alignment, indents, space before and after, and hyphenation.
`.ai` and EPS editing-data import now reads object tags
(`/identifier (string) XT`) and applies each one to the object before it,
whatever kind of object it is. The `AdobeURL` tag sets the object's URL.
Every other tag is added to the object's data in order, up to 64 per
object. A tag with no object right before it, with an empty identifier,
or with an identifier or string longer than 64 KiB is ignored, and so
are tags in a pattern's or brush's art. A clipping path keeps its own
tags; the copy that paints its fill gets none.
Before, a tag on art that shows was an operator the reader did not know,
so it stopped the editing data from being read, and brush art holding a
tag was not read, so the brushes using it were left out.
An image's tags follow the `XH` that ends its data, and the state written
after a group or a gradient mesh is still theirs when their tags come
first. When a drawn look stands for an object whose style is not found,
the look keeps the object's note, URL and data, and a live blend keeps
those of its drawn steps.
`sync_views` matched views to documents by uid only while the number of
documents was unchanged. A `command.batch` (or a recording) that closed a
document fell back to matching by position, so the documents after the closed
one took their neighbours' views, and a move later in the same batch was not
applied to the views. The views are now matched by uid whenever the documents
change: a closed document's view is dropped and a new document gets its saved
view. Closing from the UI no longer removes the view by hand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editing copy for other apps now writes linear and radial gradients and
grid patterns as themselves instead of as average colors and cut tiles.
- Gradients the art uses are defined in the setup (`n Bn`, then
`%AI5_BeginGradient` … `Bd`, the stops as `Bs` with their opacity and
midpoints, `BD`), and gradient swatches nothing uses in a non-printing
block. Stops keep gray, CMYK, RGB and spot colors at a tint. A
gradient that isn't a swatch gets a name that no swatch or pattern of
the document has.
- Each fill or stroke with a gradient is an instance around its painting
operator (`Bb`, `Bh`, `Bg`, `Xm`, `Bm`, `Bc`, `BB`), on a compound
path's last subpath and on clipping paths too. `Bg` places the gradient
relative to the path: a linear one by its angle and its start and length
as fractions of the path's extent along it, a radial one by the matrix
that takes the unit circle onto its extent ellipse, its center as
fractions of the path's bounds in that circle's space and its radius as
a multiple of the one the center's distances to the right side and to
the bottom give. In a pattern's tile the placement is mirrored top to
bottom.
- Patterns whose tiles make a grid and hold their art are defined with
`%AI3_BeginPattern` … `E`, the tile's box first, and fills and strokes
paint with `p` and `P`; gradient and pattern swatches are in the palette.
- Freeform gradients, gradients along or across a stroke and gradients
without stops, with more than 256 stops or without extent are written
as their average color, and other patterns as their tiles cut to the
shape, each with a warning. Gradients that dither or mix perceptually
are written as classic ones, stops linked to global process colors as
their colors, and pattern swatches without the placement that moves,
turns or scales their pattern, with warnings.
- Reading: an unpainted box that a pattern's definition marks as its
tile's box (`AIPattern_Editor_Backing_Tile_Rect`) is no longer read as
art, and a linear gradient whose stops all lie at one place keeps each
stop on its side.
The definitions, instances and patterns follow sections 3.4, 3.5 and 14
of the version 7 specification
(http://mercator.elte.hu/~saman/hu/okt/AI7FileFormat.pdf). The stop
opacity, `Bg`'s placement and the marked tile box follow the newer form
that current .ai files carry, which that specification predates.
Each of these is written in the form VectorCraft's .ai reader reads, and
the tests read the written data back through that reader.
Docs: docs/file-format-parity.md.
The editing copy of the art now writes a guide as its path followed by
`(N) *`, or `(n) *` when the path is closed, without the `(N) *` before
the path. The legacy version 7 .ai keeps both, as section 6 of the
version 7 specification shows them
(http://mercator.elte.hu/~saman/hu/okt/AI7FileFormat.pdf).
A ui.pointer request waits, ahead of the requests after it, until the
synthetic input sent before it has been applied. When its caller gave
it up during that wait, the request still waited there, and the
requests behind it waited for up to 1024 queued input events and could
time out.
A given-up pointer request is now dropped at once instead of waiting.
While Select All holds a threaded story, a paragraph whose text starts in one of the
story's locked or hidden frames is no longer converted, and the empty parts of a converted
paragraph in such a frame are no longer restyled. Before, a locked frame whose first
paragraph took in the previous frame's empty last part was converted, and so was a
paragraph that ran on from a locked first frame into an editable one.
After Select All in a frame of threaded text, Remove Line Breaks and
Remove Paragraph Breaks changed only the edited frame, and Convert to
Text over MCP converted only the selected frame. Both now act on the
text of every frame of the story as one undo step.
- addon.cleanup.removeBreaks reads the frames of the story as one text,
so a break at the end of a frame before a word in the next one becomes
a space. The same applies when every frame of a story is selected as
objects.
- text.convertListToText without ids, id or a range converts every
paragraph of the story. Locked and hidden frames of the selected story
are not converted, even when ids names them. When the call converts
the whole story, the story stays selected; before, the call reset the
Type tool's selection to the edited frame.
- A selection inside one frame, and unthreaded type, behave as before.
Docs: docs/mcp.md, docs/target-app-parity.md.
`the_fallback_glyph_of_a_consonant_after_its_vowel_sign_is_reported` expected
the fallback face's cmap glyph for the vowel sign I. On the Ubuntu runner the
fallback face is Noto Sans Devanagari, whose shaping draws the sign with
another glyph (545 instead of 32), so the test failed on `main`. It now checks
that two glyphs are drawn in Ka's cluster, the first is not Ka's and the
second is, and keeps the `text.glyphAlternates` checks.
Fixes#5750