Commit Graph
477 Commits
Author SHA1 Message Date
dotCooCoo ec4a1ac25d PDF export: a set Don't Include Profiles removes image color profiles
When Profile inclusion is set to Don't Include Profiles (`profiles:
"none"`), gray, RGB and CMYK images are written in device color spaces
without their ICC profiles, and a JPEG that is kept as is loses its
APP2 ICC_PROFILE segments. PDF/A-2b, PDF/X-3 and PDF/X-4 keep tagging
their images.

Leaving the setting out keeps the earlier output. `profiles` now
serializes as null when not set, `"default"` clears a preset's value,
and Save PDF > Output lists Default first. Presets and stored settings
saved earlier hold `"profiles": "none"`, so exports from them now drop
image profiles.
2026-11-15 07:27:08 -08:00
dotCooCoo 00b26dd5f8 PDF export: an overprinting element of a knockout group that does not isolate overprints the art below
A test exports a knockout group that does not isolate, whose top element
overprints, and checks that its /K group carries no /I true, that the
overprinting graphics state (/OP, /op, /OPM 1) is written, and that the
overprint and the knockout group read back. An isolated group keeps
/I true.
2026-11-15 01:54:35 -08:00
dotCooCoo 9c537a3df0 Merge main into fix/a-knockout-group-with-no-blending-inside-still 2026-11-15 01:42:07 -08:00
BFlat 9f4609ec5a Merge pull request #7811 from dotCooCoo/fix/cmyk-images-from-pdf-or-eps-lose-their-source
PDF import: CMYK images keep the profile of their ICCBased color space
2026-11-15 16:39:14 +07:00
BFlat 6ec6114d24 Merge pull request #7751 from Hassan1305/fix-7741-pdf-text-stroke-cap
PDF import: stroked type keeps its cap, join and miter limit (#7741)
2026-11-15 16:39:02 +07:00
BFlat 792cc96217 Merge pull request #7784 from dotCooCoo/fix/a-nan-spot-tint-from-a-file-reaches-plate
Print: a spot or Registration tint that is not a finite number prints no ink
2026-11-15 15:44:07 +07:00
dotCooCoo 79919e279b PDF import: CMYK images keep the profile of their ICCBased color space
An image in a four-component ICCBased color space opened with its ink
amounts but without the profile its color space holds, so PDF export
could not write it in that profile again.

- The profile is read from the color space stream (at most 16 MiB) and
  kept when it is a well-formed CMYK profile. A CMYK TIFF carries it as
  tag 34675; a CMYK JPEG kept as it is carries it in ICC_PROFILE APP2
  segments in place of its own, with its compressed data unchanged, and
  one whose segments cannot hold it is stored as a CMYK TIFF.
- jpeg_with_icc passes over fill bytes (0xFF before a marker, ITU T.81
  B.1.1.2) and leaves them out of the output.
- A malformed, non-CMYK or larger profile leaves a decoded image's TIFF
  untagged and a kept JPEG as it is. DeviceCMYK and DeviceN images stay
  untagged.
- A CMYK TIFF's tag 34675 is read up to 16 MiB; before, a 4 MiB profile
  was read back and a 16 MiB one was not. The comments of
  tiff_icc_profile and source_icc give that limit.
2026-11-15 00:34:55 -08:00
dotCooCoo 1284dc6927 PDF export: a spot stop that prints nothing keeps a gradient image in CMYK
A linear or radial gradient of CMYK stops drawn as an image (a dithered
fill, or a Perceptual gradient that is not written as a spot shading)
was written as an RGB image whenever any stop was linked to a spot
swatch, even a stop that colors nothing: one inside fully transparent
stretches, one out of order between stretches with no width, or one at
a tint of 0 without process plates. The spot color warning already
skipped those stops.

The image now falls back to RGB only when a stop prints a spot ink, the
same test the warning and the spot shadings use. A drawn spot stop at a
tint above 0, or with process plates, still gives an RGB image with the
warning.
2026-11-14 22:38:00 -08:00
HassanKhan 9dafc08f8f PDF import: a glyph stroked otherwise gets a run of its own (#7741)
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.
2026-11-15 11:05:54 +05:00
HassanKhan 1301192aeb PDF import: stroked type keeps its cap, join and miter limit (#7741)
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.
2026-11-15 10:10:41 +05:00
dotCooCoo a84d7345f1 Merge main into fix/a-nan-spot-tint-from-a-file-reaches-plate 2026-11-14 20:50:57 -08:00
BFlat dc8149cdf1 Merge pull request #7723 from dotCooCoo/fix/pdf-page-links-review
Import PDF: linked pages refuse placeholder .ai files, read the file once and keep blank pages
2026-11-15 11:37:26 +07:00
BFlat 94432bf2d0 Merge pull request #7729 from dotCooCoo/fix/pdf-image-profile-to-destination
PDF export: CMYK and other RGB destinations convert tagged images from their profile
2026-11-15 11:36:32 +07:00
dotCooCoo 1a4dd4f800 PDF export: limit the own-profile rule to destinations other than sRGB
An sRGB destination converts tagged gray and RGB images to sRGB even when the
document's own RGB profile is sRGB, so the statement that the document's own
profile as destination keeps tagged images applies only to other RGB profiles.
2026-11-14 18:39:38 -08:00
dotCooCoo f55e42343e PDF export: state that the document's own RGB profile as destination keeps tagged images
With Convert to Destination and an RGB destination that is the document's
own RGB profile, RGB colors and RGB images keep their numbers, so an image
that carries an ICC profile keeps it. The export contract and progress line
now say so, and the test checks it.
2026-11-14 18:19:33 -08:00
dotCooCoo 3cd57bca02 Merge feat/pdf-srgb-destination-converts-images into fix/pdf-image-profile-to-destination
# Conflicts:
#	crates/pdf/src/export/images.rs
#	crates/pdf/src/images.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-14 18:11:47 -08:00
dotCooCoo 201188c3a8 Print: a spot or Registration tint that is not a finite number prints no ink
Separations Preview and printed separations clamped a linked spot or
Registration tint to 0..1, but a NaN tint passed through the clamp and
reached the plate's coverage as NaN. A native file can store an infinite
tint (a number such as 1e39 read into an f32), and a blend between two
such paints yields NaN. A tint that is not a finite number now prints no
ink, as a gradient stop's process plate amounts already did; finite tints
are still clamped, and a stop's process plates still print beside it.
2026-11-14 18:06:57 -08:00
dotCooCoo 18e5e393d2 PDF export: warn when a tagged image can't be decoded for sRGB conversion
With Convert to Destination and an sRGB destination, a gray or RGB image
with an ICC profile whose pixels can't be decoded (a header past the
decoding allowance) was kept with its profile and no warning. It now
reports that the image is not converted. When the image is left out of
the file as well, only the warning that it is missing is given.
2026-11-14 17:57:51 -08:00
dotCooCoo 5956076b9f PDF export: CMYK and other RGB destinations convert tagged images from their profile
With Output › Convert to Destination and a CMYK destination, or an RGB
destination other than sRGB that images are converted to, an RGB image
that carries an ICC profile had its numbers read as sRGB, so a Display
P3 image came out with the wrong colors. Such an image is now converted
from its profile to sRGB with the color settings' rendering intent, then
to the destination.

- An untagged image converts from sRGB as before.
- A gray image keeps its profile, as gray is not converted.
- A profile the color engine can't read leaves the numbers read as sRGB,
  with a warning.
- Preserve Numbers is unchanged.

docs/mcp.md, the document.exportPdf params text and the progress doc
describe the behavior.
2026-11-14 17:44:50 -08:00
dotCooCoo 7d205368e8 PDF export: Convert to Destination converts tagged images to sRGB
With Output > Convert to Destination and an sRGB destination, a gray or
RGB image that carries an ICC profile (a Display P3 TIFF, a PNG or JPEG
with an embedded profile) is converted from that profile to sRGB with
the color settings' rendering intent and written without the profile.
Before, it kept its own numbers and profile.

- A 16-bit image that is not resampled or recompressed stays at 16 bits
  a sample from PDF 1.5 on.
- A JPEG kept as JPEG whose samples the conversion leaves unchanged (an
  sRGB profile) keeps its JPEG data; other JPEGs are encoded again.
- A black-and-white image whose converted levels are gray is compressed
  as grayscale.
- A profile the color engine can't read is kept, with a warning.
- Without conversion, and with Preserve Numbers, images keep their
  profile as before.

IccProfile::to_srgb_pixels converts a run of pixels in one pass.
Docs: docs/mcp.md, document.exportPdf params, target-app-parity.
2026-11-14 16:59:18 -08:00
dotCooCoo 1ba9b9e7cd PDF export: a knockout group that does not isolate is written without /I true
An opaque knockout group in Normal mode with isolate off and nothing
blending inside was written as an isolated PDF knockout group (/I true
/K true), and a clipped one was drawn in an isolated form. The group's
elements now start from the art below it, as on the canvas: the /K
group carries no /I, and a clipped group gets no isolated form. An
isolated knockout group keeps /I true.
2026-11-14 16:53:01 -08:00
dotCooCoo e6bfe40d30 Import PDF: linked .ai pages open on their trim boxes with the bleed
With linkPages and cropTo: crop, a PDF-compatible .ai opened on its crop
boxes, while opening it as art uses its trim boxes. It now uses the trim
boxes too. A page on its trim box shows its bleed box round the
artboard, and the pages' bleed (the widest on each side) becomes the
document's bleed, as the importer sets it.
2026-11-14 16:42:06 -08:00
dotCooCoo 094971e3ac Type on a path: type on an open path can start before the path
Type on an open path can now start before the path's start: its start
is stored below 0, the span runs from there, and the characters whose
middle falls before the path's start are not drawn, as SVG 2 lays out
text on a path (https://www.w3.org/TR/SVG2/text.html#TextLayoutPath).
The text keeps every character, and the start bracket stays at the
path's start. Past the path's end, text that does not fit is overflow,
as for other type on a path. Type that starts on the path draws every
glyph as before.

- SVG import keeps a <textPath> start before an open path's start
  (text-anchor end or middle, or a negative startOffset) instead of
  starting the text at the path's start, which drew every character.
- SVG export writes it as a negative startOffset.
- PDF export writes only the characters drawn on the path.
- The legacy .ai and .ai editing data writers write the type from the
  path's start with the type attributes warning.
- type.pathOptions takes a start below 0 for type on an open path; on a
  closed path it is the path's start, as before. A flip starts the type
  at its start bracket. Dragging the center bracket slides it from where
  it starts, and no further before the path.
- A click at the path's start places the caret by the first drawn
  character, and the caret in the hidden characters stands at the
  path's start. The highlight of substituted fonts and glyphs leaves
  them out.
- Release Type on a Path keeps the first drawn glyph where it was
  drawn, with the hidden characters before it.
- The Touch Type tool shows no box for a hidden character, and
  text.touchType returns an error for one. A character with a drawn
  glyph is changed by that glyph.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-14 15:44:12 -08:00
BFlat 4fffbce639 Merge pull request #7614 from dotCooCoo/fix/export-cull-brushed-path-art
PDF, EPS and print: a brushed path just off the page whose brush paints onto it is written
2026-11-15 06:17:15 +07:00
BFlat 03cca98963 Merge pull request #7673 from dotCooCoo/fix/pdf-layers-long-page-symbol-art
Export: hidden PDF layers place symbol art effects when a long page raises the version
2026-11-15 06:16:33 +07:00
dotCooCoo 9fb5abfbc6 Export: hidden PDF layers place symbol art effects when a long page raises the version
A PDF/A-2b export at PDF 1.4 with Create PDF Layers and a page longer
than 14,400 pt is written as PDF 1.6, which has PDF layers. The export
decided which layers place their instances' symbol art before it raised
the version, so a hidden layer, written as a PDF layer that is off, kept
its instances' art without the art's live effects.

The version a long page needs is now settled before the document is
baked. The pages come from the artboards, which baking leaves as they
are.
2026-11-14 13:28:34 -08:00
dotCooCoo 5afe6b3b73 PDF export: a PNG or JPEG profile cut short is left out too
The check before a PNG or JPEG is embedded as it is read the profile's
color space only from a profile of at least 128 bytes, so a gray or RGB
profile cut short after its color space reached the PDF writer. The
color space is now read from bytes 16..20 of any profile that holds
them, and valid_icc rejects the short profile.
2026-11-14 13:12:25 -08:00
dotCooCoo 8e6c948010 PDF export: a JPEG written without its profile keeps its JPEG data
In PDF/X-1a, a tagged gray JPEG that the Compression settings keep as
JPEG was decoded and written with Flate. It is now written with its
JPEG data unchanged, in DeviceGray without its profile.

A PNG or JPEG embedded as it is now has its gray or RGB profile checked
with valid_icc, like the images the recoder writes: a malformed profile
is left out, the JPEG keeping its JPEG data and the PNG decoded.
2026-11-14 12:56:47 -08:00
dotCooCoo af47bc5c3b PDF export: a malformed gray or RGB profile is left out of an image
A gray or RGB image is tagged with the ICC profile it carries only when
the profile passes the checks a CMYK image's profile already passes: at
most 16 MiB, the size its header declares, the acsp signature, an input,
display, output or color space profile class, and a tag table that lies
within it. Otherwise the image is written in DeviceGray or DeviceRGB, kept
as it is, resampled or compressed with JPEG.
2026-11-14 12:33:08 -08:00
dotCooCoo 4ee24a8bbe Merge main into fix/export-cull-brushed-path-art 2026-11-14 12:29:41 -08:00
dotCooCoo aa3e74384b PDF: PDF/X-1a test covers a tagged 16-bit gray TIFF
The PDF/X-1a case of tagged_tiffs_keep_their_icc_profile also exports a
16-bit gray TIFF with a gray profile, kept as it is, resampled and
compressed with JPEG, and checks each written file with the PDF/X-1a
check as well as its image color space.
2026-11-14 12:11:04 -08:00
dotCooCoo 9317ee0653 PDF: 16-bit TIFF test checks the written samples
The tagged TIFF test now compares the decoded image data with the source
for a 16-bit RGB TIFF whose high and low sample bytes differ: big-endian
16-bit samples at PDF 1.7, and the samples reduced to 8 bits at PDF 1.4.
A byte-swapped or truncated stream no longer passes.
2026-11-14 11:43:26 -08:00
bflatastic 79572cbf6c Revert "Cut over roxmltree, png, tiff, psd, and trace codecs to craft-libs (#7638)"
This reverts commit bada8e1710. #7638 merged with its gate failing: besides six unformatted
files, render and trace don't compile against craft-libs e2dc681 (u64::from(usize) in
render/src/paint.rs, a private craft-libs function, and a call with one argument too many in
trace/src/opaque.rs), so main's CI fails. The tree is that of 0adbdce6cb, whose CI passed.
2026-11-15 02:26:07 +07:00
Dylan M. Taylor bada8e1710 Cut over roxmltree, png, tiff, psd, and trace codecs to craft-libs (#7638) 2026-11-14 13:49:50 -05:00
dotCooCoo 6b9564c60d PDF: PDF/X-1a test covers a tagged gray JPEG
The PDF/X-1a case of tagged_tiffs_keep_their_icc_profile also exports a
gray JPEG with a gray profile, kept as it is, resampled and compressed
with JPEG, and checks that it is written in DeviceGray without the
profile. The comments on decoded_image, recode and the test say that
PDF/X-1a allows no ICC-based color spaces.
2026-11-14 10:48:45 -08:00
dotCooCoo 588e8e0bb0 Merge main into fix/pdf-tiff-keeps-icc 2026-11-14 09:48:14 -08:00
BFlat e76f8d2c88 Merge pull request #7501 from dotCooCoo/fix/export-bakes-symbol-art-effects
Export: live effects in symbol art apply in PDF, EPS, print and DXF
2026-11-15 00:41:46 +07:00
BFlat 63129de08a Merge pull request #7595 from dotCooCoo/fix/image-scaling-alpha
Images: scaled-down images keep their color beside clear pixels
2026-11-15 00:41:27 +07:00
dotCooCoo f8c5d2b6c0 Merge main into fix/pdf-tiff-keeps-icc
# Conflicts:
#	crates/pdf/src/images.rs
2026-11-14 07:31:28 -08:00
dotCooCoo a40f00ece9 Merge main into fix/export-cull-brushed-path-art 2026-11-14 07:25:25 -08:00
BFlat b541d97a06 Merge pull request #7586 from dotCooCoo/fix/blend-spot-stop-plates
Blend: steps between gradients linked to the same spot swatch keep its process plates
2026-11-14 21:54:47 +07:00
BFlat 8863c41560 Merge pull request #7581 from dotCooCoo/fix/pdf-cmyk-image-keeps-icc
PDF export: CMYK images that keep their numbers carry their ICC profile
2026-11-14 21:53:33 +07:00
BFlat 508a0b0180 Merge pull request #7597 from dotCooCoo/fix/separations-spot-stop-plates
Print: a spot gradient stop prints its process plates on the separations
2026-11-14 21:51:47 +07:00
dotCooCoo e45c6f518e PDF export: PDF/X-1a writes tagged gray images in DeviceGray
PDF/X-1a allows device colors only, but a gray TIFF that carried a gray
ICC profile kept it when no color conversion applied, and the export
then failed its PDF/X check. A gray or RGB PNG or JPEG with a profile
went the same way through the PDF writer. In PDF/X-1a, images are now
written without the profile they carry; the other standards and plain
exports keep it.
2026-11-14 06:02:55 -08:00
dotCooCoo 80854eb4b8 Merge main into fix/export-bakes-symbol-art-effects 2026-11-14 06:00:09 -08:00
dotCooCoo e086cf6d83 PDF, EPS and print: brush art painting onto the page keeps its path 2026-11-14 05:51:22 -08:00
dotCooCoo 786dcc5581 Images: scaled-down images keep their color beside clear pixels
The image crate's filtered resize filters each channel on its own, which
is correct only for premultiplied pixels, and its thumbnail averages each
channel on its own too. Placed images, linked-image previews, MCP
captures and previews, metafile bitmaps, PDF downsampling and library
thumbnails passed straight RGBA to them, so the color under clear pixels
(usually black) bled into the opaque pixels beside them and darkened
cut-out edges.

vectorcraft_doc::resample scales such images with each pixel's color
weighted by its alpha: filtered resampling premultiplies the pixels in
place and divides them back after, and averaging takes the area-weighted
mean of the pixels each new one covers. Opaque and alpha-free images are
scaled as before. PDF export also multiplies the inks of a CMYK image
with alpha by that alpha before resampling them, and divides them by the
resampled alpha after.
2026-11-14 05:07:39 -08:00
dotCooCoo 6ab46b5fd8 Print: a spot gradient stop prints its process plates on the separations
A gradient stop linked to a spot ink that also carries process plates
(a DeviceN stop opened from a PDF) printed only its spot tint: print
separations and Separations Preview left its Cyan, Magenta, Yellow and
Black plates blank. They now print the stop's plates beside the tint.
With spots printed as process, each process plate prints the stop's
plate layered with the spot tint's process equivalent, as a separated
image's spot plates layer. Plates beside no spot link, or beside
Registration, still print nothing of their own.

The color visitor also skipped a freeform gradient's points, so print
plates kept their display colors and Document Color Mode left them
unconverted. The points are now visited as unlinked colors.
2026-11-14 04:46:10 -08:00
dotCooCoo 3a6b016253 Blend: steps between gradients linked to the same spot swatch keep its process plates
A blend between two gradients whose matching stops are tints of one spot
swatch kept the link and interpolated the tint, but every step's stop lost
the process inks (C, M, Y, K) printed with the spot ink, so PDF export wrote
the steps as the spot ink alone.

- Matching stops linked to one swatch interpolate each process ink with the
  tint; a stop without process inks counts as none of each, and the ends
  keep their own.
- Gradients with different stop counts keep the inks at every resampled
  stop, interpolated with the midpoint-adjusted fraction between two stops
  of one swatch.
- A solid blended with a gradient brings no process inks of its own: its
  stand-in gradient no longer copies the other gradient's.

Stops of different swatches, or linked and unlinked stops, still blend into
unlinked process colors without plates.
2026-11-14 04:25:55 -08:00
dotCooCoo efb31aa51a PDF and EPS export: gradients name only the spot inks of stops that color something
A gradient's Separation or DeviceN space, and EPS's %%DocumentCustomColors,
named the spot ink of every linked stop. A stop out of order whose
neighboring stretches have no width, a stop at a tint of 0 without process
plates, and in PDF a stop whose stretches are fully transparent print no
ink, but their spot inks were still declared, so separations got an empty
plate.

- vectorcraft-color: Gradient::drawn_stops (the rule Document Info uses,
  moved here) and Gradient::reached_stops (every stop taken as opaque).
- PDF: Separation and DeviceN shadings, the Perceptual spot shadings and
  the spot-image warning name only inks of drawn stops at a tint above 0
  or with process plates; other stops are written with no ink, so their
  process inks and RGB or Lab colors no longer shape the space either.
- EPS: the same with reached stops, since EPS writes stops opaque; a
  transparent spot stop keeps its ink.

Output is unchanged when every stop colors part of the gradient and every
spot stop has a tint above 0 or process plates.
2026-11-14 04:11:40 -08:00