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.
A geometry effect is given the object's box as its reference, for
example the center a Transform effect scales and rotates about. Drawing,
the preview bounds, Expand Appearance's first step, shape art, the
outline check of the .ai reader and a stroke's effects before a Transform
that makes the stroke a path of its own measured that box with kurbo's
bounding_box, which counts only segments. A lone anchor was left out, and
a path of one anchor measured a box at the origin, so it scaled about
(0, 0). PathData::bounds, which the selection's box, Align, Transform
Each and every later effect in the stack use, holds lone anchors.
- geom: anchored_curve_bounds measures a BezPath as PathData::bounds
measures the path it stands for.
- render, effects and the .ai reader give geometry effects that box.
Gradient reference boxes and clip regions are unchanged.
The test shards' feature check (`cargo xtask ci shard`) stopped every
shard before any test ran: "vectorcraft-eps: features [] in shard 4,
[work-count] with the whole workspace". Only vectorcraft-engine's
dev-dependencies turned the feature on, and shard 4 tests
vectorcraft-eps without vectorcraft-engine. vectorcraft-eps now turns
it on in its own dev-dependencies, as vectorcraft-pdf does for
read-count, so it builds with the same features in its shard as in the
whole workspace.
Measuring the data of an image too large to hold charged one operation
per 256 decoded bytes. A program that measures the same 300 MiB of
compressed zeros in a loop decoded about 22.8 GB, about 72 passes,
before its budget ran out, and the reading took about 55 s.
measuring_data_too_large_to_hold_in_a_loop_runs_out_of_the_budget took
58 s alone and failed its 300 s guard in a loaded full test run.
Measuring now charges one operation per 16 decoded bytes, and stops at
what the budget still pays for at that rate. A program's budget grows by
64 operations per byte, so one image compressed up to 1024 to 1 is still
measured within what its own bytes add. The loop now runs out of the
budget in its fifth pass, and the test takes 3.6 s.
The test also checks how much was measured: more than one pass and at
most five. With the old rate it fails with 22781165568 bytes measured.
PathData::bounds now counts a subpath of one anchor, so three places
that measure what a path paints measured a point nothing paints:
- .ai import: the box arrowheads are placed against measured a visible
fill by the path's geometric box. A filled path with a head and one
stray anchor no longer fit the drawn look, so its style was not read.
The fill now measures PathData::drawn_bounds(false).
- Type copies a Transform effect moves: the ink box of the glyph
outlines now counts a contour of one anchor only where a round or
projecting character stroke cap draws it as a dot.
- .ai envelopes: a piece of type outlines made only of contours of zero
length kept them and counted their point. It now counts nothing, as
the rule for such contours says.
Tests: a filled line with a head and a stray anchor still fits a look
of the line and its head; a dot-only piece beside a stroked square adds
nothing to the square's box. Both fail without the change.
Six engine tests guarded against quadratic or unbounded work by timing
it (under 2, 10, 30 or 60 seconds) or by printing how long it took. A
slow or loaded machine could fail them, and a regression that stayed
under the bound passed. Each now counts the work the guarded code does
and compares it with a smaller input or with the code's own limit:
- An unknown command id or parameter key of 200,000 characters compares
no more characters than one of 20 (edit-distance cells).
- A Word .doc with 20,000 hidden paragraphs reads at most one more Prl
per paragraph than one with a single paragraph, and each style's
properties are read once.
- One function-based shading filling 5,000 paths takes no more function
evaluations than filling one, and twenty stay within the import's
evaluation budget.
- A form decoding to 64 MiB drawn 1,000 times is walked no further than
the page's form-content limit and one more form.
- A blend of 998 steps measures no more laid steps per object than a
blend of 3, and one of 1,500 steps is not laid out.
- Retype of a tracked line of 450 glyphs lays out at most 20 times the
glyphs a line of 45 does.
The counters are test-only: thread-local cells in the engine under
cfg(test), and in vectorcraft-pdf (read-count feature) and
vectorcraft-eps (new work-count feature), which the engine enables in
its dev-dependencies only. Retype's layout calls go through one helper
that counts them.
The previous commit made PathData::bounds hold the point of a subpath of
one anchor. Node::visual_bounds measures a path from that box, so a lone
anchor that draws nothing (an open one, or a closed one under a butt cap
or with no stroke) widened the visual box by the stroke's reach. The
renderer draws a lone anchor only as the dot of a round or projecting
cap on a closed subpath (point_dots in crates/effects/src/stroke.rs).
- PathData::drawn_bounds measures the segments, and the lone anchors of
closed subpaths when a cap draws dots. Node::visual_bounds measures
paths and compound paths from it, falling back to the geometric box
when nothing is drawn. Geometric bounds still hold every lone anchor.
- The .ai envelope import's box of what type's outlines paint relied on
PathData::bounds leaving lone anchors out. It now removes contours of
zero length from the baked pieces before measuring them, so
a_contour_of_zero_length_paints_nothing passes unchanged.
An envelope whose file saves the size of its contents with their
strokes maps from that box, with margins stored as shares of the
contents' height and width. A straight line along an axis has no
height (or no width), so it got no margins and mapped from its
zero-height geometric box instead.
Margins along a side with no length are now shares of the other
side's length (envelope_margin_lengths). The reader, the envelope's
map, leaving Edit Contents and the .ai writer all measure through it,
so a stroked line opens mapping from its stroked box and saves that
box's size again.
Docs: object.envelope.info params text, docs/mcp.md,
docs/target-app-parity.md.
The styles that link type's colors to their swatches were made before
the writer knew whether the type's story would be written. Type written
as its outlines after all (a thread the text document can't hold) left
its style behind, named by nothing. Such a style is now written only
when a story names it.
Since the previous commit they are written on a large canvas too,
where no other art style is: they hold no lengths to scale. The large
canvas warning now says "no art styles of objects", the comment beside
it says why, and the large canvas test (renamed) checks that spot type
there reads back linked with no warning.
A note on the previous commit's message: "the saved file opened with
the type in a plain process color" is only true when the saved file is
read from its editing data (another app, or VectorCraft once the
VectorCraft document it carries no longer matches its pages). A plain
reopen in VectorCraft restores that document and already kept the ink.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Type in a spot ink or a global process color was saved to the text
document as its process values alone (a /SimplePaint with key 0), so
the saved file opened with the type in a plain process color: off its
ink's plate on separations, and white type in a white ink on none.
Saving warned about it ("swatch links of its colors").
A run's fill or stroke now names (key 5 of a /CAITextPaint) an art
style of one paint, its fill alone on (`0 1 Xd`), whose paint is the
color as a path's fill writes it (`x`, `Xx`, `Xk`, or `Xs` for
Registration). That is the form the .ai reader takes the ink and the
tint from since the previous change; key 0 keeps the process values.
Each style is read back with the reader's own parser before it is
used, and a link is kept only when it gives the same swatch and tint.
Those runs no longer count among the attributes of type left out;
a link to a process swatch that isn't global still does, and the
warning's text now says so.
Test in crates/eps/src/ai_editing/tests.rs. The parity doc has the row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The color a one-paint style holds for type was kept whenever its last
paint was a fill color with a swatch. A stroke color set before the
fill's still linked the type, and the style's `Xd` wasn't looked at, so
a style with its fill off gave its color too.
The style now holds the color only when its `Xd` turns on the fill
alone (`0 1 Xd`) and nothing sets a stroke's color or pattern, before
or after the fill's. No file I have writes a style any other way, so
this changes no real file; the pattern a style holds for type is read
as before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Type set in a spot ink or a global process color opened as a plain
process color: right on screen, but on separations it printed on the
process plates, and white type in a white ink on none.
In the text document a character's fill or stroke is a color (key 0)
and the name of an art style (key 5). For a color with a swatch, key 0
keeps only its process values at its tint; the name and the tint are in
the style, a style of one paint (`c m y k (name) tint x`, `Xx`, `Xk`),
always its fill's, for a stroke too. The reader took key 0 alone.
The style reader now keeps that paint (`ArtStyle::simple_color`), the
way it already keeps a one-paint style's pattern, and the type takes it
in place of key 0's color: the color at its tint, linked to its swatch.
The styles' named colors make their swatches with the art's (after the
art's colors, before the header's custom colors), so type and art in
one ink share a swatch, and a color that takes a free name is linked by
that name. Registration is linked to the built-in swatch.
`Texts::with_patterns` and the fields beside it are renamed to
`with_paints`, since they now hold both.
Tests in crates/eps/src/import/tests_native.rs, ate.rs and
ai/style/tests.rs. The parity doc has the row.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A centered line of 72 point type on a tight leading, as garment
headings are set: with the estimate box the page's type has no text
object and the import notes a loss; with the laid-out box it is the
text object's. The 14 point centered case passes either way, as the 6
points round the estimate cover half of so short a line.
`drawn_box`'s comment says what it lays out (any point type without a
layout, in the installed fonts) and where it is used.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The page comparison tells type that differs from art that differs by
where the layers' text objects are (`type_areas` and `all_type_areas` in
`crates/eps/src/import/native/compare.rs`). Type made from the file's
text document has no layout then, so its box was the estimate of type
without one, running right from its anchor: right-aligned type draws on
the other side of it, centered type half outside it, vertical type
across it. What differed there (type laid out again, or in another
font) was counted as art, which is held to a stricter limit: the layers
could be refused and the file sent to its PDF part or page, or the note
said the art differs where the type does.
The type areas now come from where the type draws: `drawn_box`, the box
the first commit matches by, moved to `slots.rs` so both use it. The
page's own type keeps its measured box, as before.
`prune_unseen` and the boxes of made type that doesn't show still use
the estimate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Type made from a file's text document has no layout when the import
matches it with the page's type, so the box it was matched by was the
estimate of type without a layout: as wide as an average font would set
it, running right from its anchor. Right-aligned point type draws on the
other side of its anchor, centered type lies half outside that box, and
vertical type runs down the page across it. Where the text document
makes the type of every text object that shows (`made_only`), the page's
type there was then nobody's: the import noted "some of the page's type
has no text object in the layers, so it is left out" for type that is in
the layers, and the made type, not seen on the page, was weighed against
the page as type the page may not draw, and sometimes taken out.
`made_only` (`crates/eps/src/import/native/plan.rs`) now takes the box
of made point type that shows from its layout (`drawn_box`), in the
fonts the import has, as the document measures it once it is open. The
node itself keeps no layout, so the document's type is measured when it
opens, as before. Area type and type on a path are matched by their
frame and path, as before.
Where some text object's type isn't made (`plan`), the box stays the
estimate: there the page's pieces in the box where made type draws can
belong to text objects stacked on it whose type isn't made, and the
made type would take them all.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both .ai writers write a distorted image at the nearest parallelogram when
it sits 8 deep in opacity masks, symbols, live objects or pattern tiles
(the editing data) or in symbols and live objects (legacy .ai), and leave
out art nested deeper. Their warnings said "more than 8 deep", which named
images the writers never reach. Both now say "nested 8 deep", as
docs/mcp.md does.
On a separated PostScript plate, a process white fill, stroke or
character fill or stroke marked to overprint kept its overprint flag
with Discard White Overprint on, so it was drawn as nothing and the ink
below it stayed. The plate document now turns overprinting off for
those whites, so they knock out as in composite output. White linked to
a spot swatch that has a color, at a tint above 0%, still overprints.
An overprinting colorized image in the tile of an overprinting pattern
fill is now written in only the process inks it puts down, as it is
outside a pattern, instead of as a full CMYK image that removed the
inks below it.
The params text and docs/mcp.md now say the spot exception needs a spot
swatch with a color.
Illustrator writes a gradient instance around only the last path of a compound path; the paths before it keep the default fill. paints_apart read that as a drawn look whose paths paint apart, so a sunburst's rays became black paths plus one gradient path. Several alike paths followed by one painted with a gradient or pattern are now the subpaths of one compound path, which takes the last path's paint.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The white checks for colorized images in PDF export, EPS export and Print
Ink Fixes now go through DiscardWhite, which replaces
Document::spot_ink and Document::discards_white_overprint. Printed
separations read DiscardWhite with the spot inks they print, so a white
spot ink converted to process inks knocks out there.
Discard White Overprint covers process white only. A white fill or
stroke linked to a spot swatch at a tint above 0% is written as its own
Separation ink and now keeps overprinting. Global process swatches, a
0% tint and a spot swatch without a color still knock out.
With Discard White Overprint on, PDF export, Overprint Preview,
Separations Preview and printed separations took the overprint off any
white paint, including a tint above 0% of a spot swatch whose color is
white, which prints as that ink. Such a tint now keeps its overprint in
fills, strokes, character paints and a colorized image's color; process
white and a 0% tint still knock out.
DiscardWhite holds the setting and the document's spot inks, and
Document::discards_white_overprint gives the same answer for the PDF and
EPS writers.
Discard White Overprint removed the overprint of a colorized image whose
color was white, even when that color was a tint of a spot swatch, which
the EPS writer still writes as that spot ink. A spot white now keeps its
overprint; process white still knocks out.
Document::spot_ink tells a tint above 0% of a spot swatch with a solid
color apart from paper white.
The carried families were collected for the whole document, so type in
a font the file only names, of the same family and style as a carried
font, counted as carried though it draws in the fallback font, and its
fallback warning was missing. Each text's runs are now classified by
the file fonts bound to that text.
The warning took a family as carried when any style of it was, so a
named bold beside a carried regular lost its fallback warning. Carried
and fallback are now decided per family and style, and a family can be
named in both sentences.
The kept fonts were attached by family and style, so type in a font
the file only names whose family and style are those of a carried font
(`TestOne-Roman` beside an embedded `TestOne`) got the carried font too,
after its spacing had been set for the fallback font. Type shown in a
carried font is now marked when it is made, and only marked type gets
the kept font.
`fits` compared each glyph with every earlier glyph of its character in
the string, so a long string of one character took quadratic work. It
now compares each glyph once with the one its character already has,
as PDF import's gathering does. It also checks the font has room for
the characters it doesn't have yet: a string that needs one more than
the font can hold comes in as outlines, keeping the file's look,
instead of as type the kept font can't draw.
Type in a Type 1 or Type 42 font an EPS embeds came in as live type in
the fallback font when its family isn't installed. As PDF import has
done since #4569, the glyphs that type is shown in (outline and advance
from the font program, for each character) now become a font kept with
the document, which draws that type as the file does until its text is
edited, and spaces it by the glyphs' own advances. A string that draws
a character with a different glyph from the one kept for it comes in
as outlines. The warning names those families with PDF import's
sentence for fonts a file carries.
Fonts the file only names, Type 3 fonts and type from an Illustrator
editing copy are unchanged.
- A fill or stroke with an opacity of 0 no longer counts as a row that draws on a
colorized image, so it does not stop the image overprinting as a whole.
- On printed plates, an overprinting colorized image whose pixels do not take its
color knocks out and prints as those pixels, instead of being hidden on the
plates its color has no ink on.
- EPS export writes a white colorized image knocking out when Discard White
Overprint is on, instead of leaving it out of the page.
* PDF import: keep embedded fonts for text whose family isn't installed
Glyphs drawn in an embedded font whose family isn't available are gathered
during import and built into one small TrueType font per family and style,
kept with the document (font/ttf blob). Text objects record the fonts and a
hash of their text: layout and rendering draw them in the kept font until the
text is edited (undo restores it) or the family is installed. Lines are
spaced against the file's own widths with per-glyph placement (#3756).
* PDF import: satisfy crate layering constraints without format dev-dep
* FileFont: negate us_win_descent in i32 to prevent overflow on extreme negative descenders
* PDF import: a kept font carries the file font's licence flags, and the docs say what that means
Review of #4569: the fsType of the file's font is copied to the font built from its glyphs (a test pins it against Embedding), so exports honour it; the docs state the limits, that the file's font program is not parsed, and that a saved file carries third-party glyphs.
* PDF import: a glyph curve far outside any glyph is left out; docs say what the limits and the font program mean
CodeRabbit on #4569: coordinates beyond 1e6 font units are refused before the curve is subdivided. The docs say the 64-font limit is what draws one type object and that the file's font program is read only for its licence flags and metrics.
* PDF import: two programs of one font keep the stricter licence flags; the docs cite their sources
CodeRabbit on #4569: embedded programs of one family and style share one built font, which kept the first program's fsType; it now takes the stricter of the two, whichever came first. The docs entry cites the Acrobat Help pages and the OpenType fsType specification.
* fmt
* PDF import: embedded fonts are on by default, with an opt-out preference
Owner decision on #4568. Preferences > File Handling > Use fonts embedded in imported PDFs (pdfImportEmbeddedFonts, on by default) and the embeddedFonts param of document.open and file.place: off, a PDF's type in a font the machine lacks is set in the fallback font with the missing-font warning, as before. One test each for on and off, one for the preference reaching the options.
* fmt after merging main
* docs: restore the status lines damaged by merges (main's line plus this PR's note)
* PDF import: set embedded_fonts through a builder method (keeps read_opened under the complexity limit)
* PDF import: move the missing-font notes out of read_opened (complexity limit after the merge)
* #4569: isolate file-font resources and reclaim live faces (UNVERIFIED)
* Preserve carried-font ownership across placement and recovery
* Fix carried-font regression test dependencies and unwind probe
* Use explicit OS2 heights in owned-font reference regression
* Keep native font regression artwork inside document layers
* fix(engine): bind file fonts when reading document profiles
* test(engine): initialize file-font leases in new image fixtures
* test: complete file-font lease initialization in image fixtures
* docs: keep the #4568 entry in the file-format parity status line
* fix(pdf): keep a line with another glyph for the same character as outlines (review)
A font kept with the document has one glyph per character. A glyph of the file's font that
differs from the one already kept for its character (a stylistic alternate that maps to the same
Unicode scalar) marks its line, which is imported as outlines so each glyph draws as the file
does.
* docs: resolve the leftover status-line conflict
* Placed document blob: give the new ImageBlob literal its file_font
* Test: a PDF's two glyphs for one character survive a native save and reopen as the file draws them
* Test: move the native save and reopen half of the two-glyphs regression to the engine (layers: no format dev-dep in pdf)
* Fix embedded-font preference help and English fallback checks
* Format embedded-font preference help with the workspace edition
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: skylartaylor <hi@skylar.cc>
When an object passes the page body limit, the walk takes its body,
image placements and image codes back out. The glyphs it showed through
the job's fonts stayed in the page's font list, so Subset sent fonts for
type that was not printed, and Complete could send whole fonts for a face
no printed object uses. The walk now records the glyphs each object adds
and takes them back out with the rest.
Tests: the glyphs of an object left out for the limit are not in the
page's font list, and ruby readings print as outlines in place while the
base text shows through the font.
PDF export lets a fill or stroke marked to overprint do so only when it
is not white with Discard White Overprint in Output (Document Setup, on
by default). EPS export and composite PostScript printing ignored that
setting, so an overprinting white fill or stroke was written with
"true op" and the inks below it stayed visible. They now apply the same
rule to path fills and strokes, character fills and type object fills.
The tiles of an overprinting pattern fill overprint with it, as in PDF
export. Before, a tile marked to overprint wrote its own "true op" and
"false op", which turned overprinting off for the tiles after it.
Separated plates are not checked for white, since their colors are
already the plate's coverage.
Re-exporting or printing to PostScript a document with an overprinting
white fill or stroke gives different output: the white knocks out
instead of overprinting, unless Discard White Overprint in Output is off.
- Overprint Preview, Separations Preview and printed separations show a
colorized image knocking out when it has any visible effect of its own
that paints colors (a shadow, a glow, a raster effect, a color
adjustment or a plug-in effect). Only the geometry effects leave it
overprinting; a test keeps that list equal to the geometry effects of
the effect catalog.
- EPS export writes an overprinting colorized image in a gray color as
black ink alone (a DeviceN image at Level 3, a Separation image at
Level 2), so it keeps the cyan, magenta and yellow below.
- On an EPS separation plate, an overprinting image without the plate's
ink is left out only while overprints are preserved.
- Reading a legacy .ai file, a colorized image mask takes the fill
overprint in force, as it takes the fill color: its own O, or the last
O before it.