Look::takes let a glyph filled only join a run whose glyphs were also
stroked, so after mode 2 text a mode 0 glyph took the run's stroke:
`2 Tr (B) Tj 0 Tr (C) Tj` came in as "BC" stroked throughout. A glyph
now joins only a run drawn alike (fill, stroke, overprints), so a glyph
filled only starts a run of its own and takes a stroke only when the
matched-stroke path (#8039) strokes it.
flush_stroke no longer strokes a whole run in place: a whole run goes
through the split and join code, so fill and stroke rendering glyph by
glyph still builds one stroked run.
A fill and a stroke at the same opacity below 1 were joined into one
type object whose opacity then applies to both together, losing the
darker overlap the file composites. stroke_filled now takes a stroke
only when the fill and the stroke are opaque.
An upright glyph filled and stroked was kept as an outline for the
reshaped-outline fallback while upright glyphs filled only were not;
it is no longer kept either, so such a line can't come in as the
outlines of its stroked glyphs alone.
Docs: the #8015 entries say what is left (translucent type, and a TJ
that starts a new line part way through).
- The steps of a live blend are written as drawn art: copies of key
objects with text wrap options no longer write those options again.
The keys keep theirs on the hidden lines and the blend keeps its own.
- The record holds Specified Distance as a 32-bit float, which the
reader reads back as its shortest decimal. The writer now compares the
blend with that distance, so a distance typed in another unit (10 mm
is 28.346456... pt) is written live when it lays out as many steps.
- blend_steps_settled has unit tests for each of its cases.
- blends_write_the_same_bytes_again checks that every blend is written
live both times.
- Comments name the blend plugin's XP line by its constant.
- docs/target-app-parity.md lists live blends in the .ai editing copy;
a line in docs/file-format-parity.md is wrapped like the rest.
Tests: a_live_blends_steps_carry_no_text_wrap_options,
a_blend_spaced_in_millimeters_is_written_live,
steps_settle_unless_rounding_can_change_their_count.
The editing copy of a PDF-compatible .ai wrote every blend as its steps.
Blends the .ai reader opens live are now written live:
- The blend's key objects and, when it has a spine of its own, its
spine are written as a group on hidden lines, each key's dictionary
naming it a key and its id and the spine's naming it the spine. Its
steps follow as a group, then the Path Blends record of its spacing
(Smooth Color, Specified Steps, Specified Distance with its distance),
orientation (Align to Page, Align to Path) and keys, then its
dictionary (name, text wrap options, variables) and its opacity and
blending mode as a group's after its end. A spine edited on the canvas
is written with each key's anchor on the key. A replaced spine is
written with an anchor where each key sits, so it opens with those
anchors and lays out the same steps.
- Each blend is checked with the reader's own reading before it is
written, and the blends together against the objects the reader lays
out in one file. Written as their steps with a warning: blends with
easing, a color shift or start points; with effects, an appearance or
an opacity mask of their own; of objects other than paths, compound
paths and groups, of clipping groups, of more than 62 key objects, of
hidden keys or keys holding a blend; of keys with geometry or
Pathfinder effects or a group's own fills and strokes, which the
editing copy writes as their result; of keys the editing copy would
change otherwise (empty paths or subpaths, paths and compound path
members of several subpaths, several fills or strokes, strokes a plain
line can't draw, dashes of more than 64 lengths, hidden fills or strokes, fills or strokes other than
a color, in a Lab color or with transparency or effects of their own,
effects, opacity masks); blends where one key has a fill or stroke of
no paint or a stroke of no width and another has one that draws;
blends whose spine has more than one part;
blends whose step count is close to where rounding the written
coordinates and colors changes it; blends the reader would open with
other settings or not as drawn; blends inside objects with geometry or
Pathfinder effects or a group's own fills and strokes; blends in
opacity masks, pattern tiles, symbols and art cut to a clipping object
or nested eight levels deep in art written in place of other objects;
blends whose art would pass the most objects the reader reads; and
every blend on a large canvas.
- The steps set their own transparency and lock and hidden state after
the hidden lines, for readers of the printed form.
Each construct is written in the form the .ai reader reads (blend.rs,
read/document.rs blend roles, read/containers.rs end_blend, read/ops.rs
XP and transparency), and every object written counts toward the
reader's object limit as the reader counts it. The record's orientation
word and a blend with no spine part are read as #8243 reads them.
Blend Options, key objects and spines:
https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-options-overview.htmlhttps://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=260
Tests: the round trip of blends of each spacing and orientation, with
no spine of their own, an edited spine and replaced curved spines,
named, at half opacity, hidden and locked, with text wrap options, of
compound paths, of groups and of 62 keys, each laying out the same steps
as the document's blend; the record's words (Align to Path's angle
included) and the dictionaries; the steps' own state after the hidden
lines; the same bytes on a second write; each case written as its
steps, with as many steps as are drawn, where they are drawn (among
them Specified Distance 0.03 pt from where its count changes, on a
spine of 200 segments, which comes back live on a spine of two); blends in
pattern tiles, opacity masks, symbols, art cut to a clipping object and
eight levels down; the object limit; the reader's blend limit; a large
canvas; fuzz cases for damaged written blends.
Docs: docs/file-format-parity.md.
The writer measured which way each patch turns only at its first corner,
along the straight lines to the next corners. A patch whose point is
dragged across it, or whose handles cross at a corner, passed as a
plain patch and was written as a mesh. Each corner of each patch is now
measured along the straight lines and along its handles, and a mesh
whose corners turn different ways is written as its drawn look with the
warning.
- Tests: a patch folded at a corner by a moved point and by crossed
handles; a reflected mesh read back draws the same points and opacity
across each patch; an envelope in a symbol's art with its grid and
contents in the symbol's own space opens as the art it draws, and one
in a file without a template box is left unread.
- The fuzz case for written meshes moves next to the other editing-data
cases in import_fuzz.rs.
- Docs: file-format-parity.md says a reflected mesh opens with each
row's points in reverse order, and how envelopes in symbols open;
target-app-parity.md links the help page on mesh point opacity.
The editing copy of a PDF-compatible .ai wrote every gradient mesh as
its drawn look. Meshes the .ai reader reads back as they are are now
written as meshes:
- Each mesh is a /Mesh record: 2 /Version, its type and grid size,
/Data, then each patch row by row with its place, the color space
where it changes (gray, RGB or CMYK) and its four corners: color,
opacity, point, and the handles towards the next corner and the one
before it. Its opacity, blending mode and knockout shape are set
before the record, and its name and opacity mask follow it.
- A reflected mesh, whose patches all turn the other way, is written
with its columns in reverse order, which draws the same mesh.
- In a symbol's art the corners are written about the canvas point of
the ruler origin, y up, as an image's matrix there is. An envelope's
grid in a symbol's art is now written in the same space, and the
envelope's contents in its dictionary in the canvas's space, y down.
- Each mesh is checked with the reader's own reading before it is
written. Written as their drawn look with a warning: meshes with a
point in a Lab color, with more than 128 rows or columns, folded
meshes (patches that turn different ways), meshes the reader would
read with other points, handles or colors, meshes in pattern tiles
and in art cut to a clipping object, and every mesh on a large
canvas. A mesh's drawn look is written at any depth of nested
symbols and live objects.
Each construct is written in the form the .ai reader at e142c5fcee
reads: /CS, /Type, /Size, /P, /N and /E in mesh.rs:180-234, corners
with or without an opacity by their count of values in read_corners
(mesh.rs:239), the patches joined into one mesh in one_mesh
(mesh.rs:298); /Mesh X!, X# and /End X! in read/ops.rs:219-232; the
transparency after the record in read/art.rs:281 (end_mesh) and
read/ops.rs:344. /Version and /Data are passed over by that reader
(mesh.rs:234). Corners in a symbol's art rest on a reader change in
this commit.
The reader changes how any .ai opens:
- Mesh records and envelope grids in a symbol's art are read in canvas
space (read/document.rs:947 image_space), and an envelope's contents
in its dictionary in the canvas's space, y down. In a file without a
template box such a mesh is left unread, its symbol is not read
whole, as with an image there (read/art.rs:634), and its instances
open as the page draws them. Envelopes in symbols in .ai files saved
by earlier VectorCraft builds open differently.
- A point of a patch whose corners differ in color model keeps its own
color when the patches are joined into one mesh.
Gradient meshes, mesh points and their opacity:
https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=200
Patch meshes (corners joined by cubic edges with control points):
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.7old.pdf#page=321
Tests: the round trip of meshes with RGB, CMYK and gray points, a moved
point with handles of its own, part-transparent points, a name,
opacity, blending mode and knockout shape, hidden and locked, with an
inverted, unlinked opacity mask, in groups, opacity masks, symbols,
opacity masks in symbols, a document of two artboards and eight levels
down, compared point by point, handle by handle and channel by channel
at the 4 decimals written; reflected meshes, mirrored across and
along; the record's form, including corners in a symbol's art and an
envelope's grid and contents there; an envelope in a symbol read back
with its contents and their gradient in place; the same bytes on a
second write; each case written as its drawn look, with its paths read
back over the mesh's box; reading a mesh in a symbol's art with and
without a template box; /Version and /Data passed over; the color
model rule; fuzz cases for damaged written meshes, a symbol's
included.
Docs: docs/file-format-parity.md, docs/target-app-parity.md.
WebP Options has a Compression menu (Lossless, Lossy) and a Quality
slider from 0 to 100 that is enabled for Lossy. document.export,
document.serialize and Export for Screens take lossless: false with
quality (default 90) and write a VP8 file, with an ALPH chunk that keeps
the alpha exactly when some pixels are not opaque. Lossless stays the
default. A WebP quality above 100, or one that is not a whole number,
is refused with an error.
The encoder is the one craft-image-codecs already provides; no
dependency changes. The note that lossy WebP isn't available, its
catalog rows and the format text that described it are removed.
A gradient definition in the .ai editing data holds each stop's color, opacity, midpoint and ramp point, and VectorCraft's reader opens it as a Classic gradient. A Perceptual gradient was written with its own stops, so the file opened with different colors between them.
The writer now treats a Perceptual gradient as it treats a gradient mixed around the hue wheel, in the art and in the Swatches panel: the colors on its curve become stops of their own in process colors, at most 256, with a warning that names Perceptual gradients. A stop linked to a global process color reports its lost link for both methods. Dither is reported as its own loss. A freeform gradient, or one with more than 256 stops, is still written as its average color whatever its method.
Match a stroke to a filled glyph by its whole placement (origin, size,
horizontal scale, slant and direction), not just its origin, so a stroke
drawn at another size over a filled word stays type of its own. Restyle
only the matched glyphs' text instead of the rest of their run: strokes
over neighbouring glyphs gather and restyle once, so a word filled and
stroked whole stays one run, while a stroke over one glyph of a filled
word strokes that glyph alone.
With text rendering modes 2 and 6 the reader fills every glyph of a
text-showing operator before stroking them, but the importer only joined
a stroke to the glyph filled last, so a word shown in one Tj came in as
a stroke-only Type over a fill-only one. TextLine now records the glyphs
it fills and stroke_filled matches each stroke to its filled glyph in
order, splitting a run where the stroke differs.
Area type with wrap shapes was always written as outlines in the editing
data for other apps. It is now written as type when the reader works the
same wrap out again from the objects above it: each wrap object is a path
of one subpath, a compound path of visible members, or an unclipped group
of such objects, with no paint, or a solid fill, a plain solid stroke or
both, without effects, art style, opacity mask or clipping, with an
offset within -1000 to 1000 pt; the type's stored shapes match the ones
those objects give it; and the shapes of all area type stay within the
2,000,000 anchors the reader copies. Each frame of a thread is checked on
its own. When art is left out at the object limit, such type is written
as outlines again. Other wrapped area type stays outlines.
The reader recomputes the wrap with resolve_wrap after reading
(resolve_text_wrap in crates/eps/src/import/native/build.rs) and reads the
options with text_wrap in crates/eps/src/import/ai/read/document.rs; the
round-trip tests check the reopened characters, frame, wrap shapes and
wrap objects. resolve_wrap's layer walk is shared through a new
wrap_sources so the check follows the same traversal.
A default legend swatch of a stacked column, stacked bar, area or pie
series now has the thin white stroke the series' marks have, beside the
plot or across the top. Before, the swatch had no stroke, so the series
group painted with two strokes and a drawn stacked column or area graph
was saved to .ai as plain art with a warning. Both now open again as live
graphs. Stacked bar graphs are still written as art: the .ai reader has
no type for them.
The PSD Options dialog gets Preserve Text Editability, and document.export
takes preserveText (with layers). Horizontal and vertical point type is
written as a type layer (a TySh block with its EngineData) that a reader
can edit, and keeps its pixels. The layer holds the text, its fonts by
PostScript name, size, leading, tracking, scaling, baseline shift, caps,
underline, strikethrough, fill color, Fractional Widths, paragraph
alignment and orientation.
Type that a type layer would draw differently stays pixels: area type,
type on a path, strokes, non-solid fills, fractional tracking, character
attributes the layer does not carry, paragraphs that set more than their
alignment or run right to left, System Layout, Optical Margin Alignment,
ruby, effects, an appearance of its own and opacity masks. A layer that
holds type becomes a group of its type layers and pixel layers of the art
between them, unless other art in it blends in a mode other than Normal.
A filled glyph joins a run of the same fill whatever its stroke, so with
fill and stroke rendering shown a glyph at a time, the stroke replayed
over the last glyph restyled the whole run: glyphs before it took its
cap, join and miter limit. When that stroke differs from the run's, the
glyph's text now splits off into a run of its own; the line's text is
unchanged, so slots, gaps and authored flags still line up.
Also record the change in the parity and roadmap docs.
Glyph strokes reached the type's character style as paint and width only,
so stroked PDF text (rendering modes 1, 2, 5, 6, and under ActualText)
came in with butt caps, miter joins and a miter limit of 10. The text
path now carries the graphics state's line cap, line join and miter
limit, taken as paths take them, and glyphs stroked with other ones start
a run of their own.
Read image resource 1050 (version 6 records and the version 7 and 8
descriptor) and turn each slice the file did not generate automatically
into a user slice with its name, type, link, target, message, alternative
text, cell text and background color.
- document.open takes importSlices (default true) with either layer
choice; file.place takes it (default true embedded, false linked; true
with link is an error) and moves and scales the slices with the placed
art in the same undo step. file.place.info, file.place.queue and
document.psdInfo report or pass it.
- PSD Import Options gains Import Slices, enabled for a file with slices,
independent of the conversion choice, and remembered with the other
choices; a file with slices asks even with fewer than two layers.
- Slices outside the canvas, and slice data that can't be read, are left
out with a warning while the art comes in. Counts, nesting and text
lengths read from the file are capped.
Objects in an opacity mask's art inside a symbol definition or a pattern
tile are now written with their art styles, as mask art on the layers
already is. A symbol or pattern whose mask art has Offset Path opens with
the effect live in its definition, and its instances and pattern fills
draw as before. Each definition is written with the styled objects of its
own masks only, so art placed as copies inside it is not matched to
another definition's original.
- Mask art linked to a graphic style opens linked to it: the reader's
style linking now goes into opacity masks' art.
- Links in pattern tiles count toward the lost-link warning, the warning
is checked after unused symbols and swatch-only patterns are written,
and links in art left out at the object limit are no longer counted as
kept.
Files saved for versions 10 to 13 place each symbol instance with a
TransformMatrix. On the page it takes the symbol's art to the canvas
(y down); in a symbol's art, it takes the art to that symbol's space. The
reader only knew the RTransformMatrix of newer files, so any such
instance made the editing data unreadable, and the file opened from its
PDF part alone, which holds only the art on the artboards.
The reader now converts a TransformMatrix with the canvas point of art
space's origin that the template box gives. A file whose symbol
instances were the only part it could not read now opens from its
layers, with the art outside its artboards.
The symbols fuzz test also damages the same data in the older form.
Docs: docs/target-app-parity.md, docs/file-format-parity.md.
The PSB row of docs/file-format-parity.md says the merged image comes in
clipped by the file's clipping path, as the PSD row does, and
docs/target-app-parity.md's evidence list gets a line for it.
A PSD or PSB file can name one of its saved paths (image resources 2000
to 2997) as its clipping path in resource 2999. psdread::clipping_path
reads that path in the image's pixel space, under the even-odd rule the
file format specification gives, with a subpath around the whole image
first when the initial fill record says the fill starts with all
pixels.
File > Place of such a file, and File > Open of its merged image, put
the image in a clip group of that path with no paint. file.place answers
the image's id as `image`, as for a DCS file. Replacing an image alone
in a clip group with such a file keeps the image's scale and rotation.
links.update and links.relink leave the clip group as it is. Files that
name no clipping path come in as before.