Commit Graph
491 Commits
Author SHA1 Message Date
BFlat d87cc85a90 Merge pull request #7917 from dotCooCoo/fix/pdf-trim-artboards-keep-bleed
Import PDF: artboards on trim boxes keep the bleed between them
2026-11-16 04:29:59 +07:00
BFlat 58cb42509e Merge pull request #7805 from dotCooCoo/fix/an-image-whose-recode-fails-is-written-without
PDF export: an image whose colors can't be converted is left out with a warning
2026-11-16 04:28:53 +07:00
FredApps 33b5706c7a Merge pull request #7664 from storytold/fix/restore-codec-cutover-ci
Restore shared codec cutover with CI compatibility fixes
2026-11-15 21:05:52 +01:00
dotCooCoo f1507ccec3 Merge main into fix/an-image-whose-recode-fails-is-written-without 2026-11-15 10:54:25 -08:00
dotCooCoo a6d9dd2881 Import PDF: artboards on trim boxes keep the bleed between them
Opening a PDF with Crop To Trim Box put each artboard 36 pt after the
one before, while the bleed boxes round the trim boxes became the
document's bleed. With a bleed over 18 pt, one page's bleed reached
into the next artboard, and a page exported with its bleed showed part
of its neighbor. The document's bleed is now read from every picked
page first, and the artboards are 36 pt apart plus that bleed on both
sides, as linked pages on their trim boxes are laid out since #7723.
2026-11-15 10:34:12 -08:00
BFlat b759c9e369 Merge pull request #7874 from dotCooCoo/fix/pdf-dont-include-profiles-removes-image-profiles
PDF export: a set Don't Include Profiles removes image color profiles
2026-11-16 01:33:00 +07:00
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 0f7c46b04f PDF export: an image whose pixel data can't be read still warns that it couldn't be decoded
When the Output settings convert colors, a color image whose pixel data
can't be read was left out with the "couldn't be converted" warning, as
if it could have been written in its own colors. Such an image can't be
written at all, so it is again left out with the "couldn't be decoded"
warning, as every other PDF export does. Only an image beyond the decode
allowance, or one whose header can't be read, is left out as
unconverted.
2026-11-15 07:20:32 -08:00
dotCooCoo 9d9b69a544 PDF import: an isolated group with overprinting art inside stays isolated
The importer kept a group's isolation only when something inside it
blended, so an isolated group or knockout group whose objects only
overprint read back without isolation. Written out again, it lost its
/I true and its overprinting objects then kept the inks of the art below
the group that they had covered. Isolation is now also kept when a
visible fill or stroke inside, or characters' fill or stroke, overprints,
directly or through children that do not isolate.
2026-11-15 06:46:56 -08:00
FredApps c9cad8d017 Merge main into fix/restore-codec-cutover-ci
Port main's new variable-library parsing (variable kinds, image, visibility
and graph values) from roxmltree to craft-xml with the branch's strict
options and attribute validation. Keep both sides' variable tests.
Drop the stale docx::nesting doc link.
2026-11-15 15:43:44 +01:00
dotCooCoo 5ce407dfbf Merge main into fix/an-image-whose-recode-fails-is-written-without 2026-11-15 06:17:33 -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
dotCooCoo 149280032e Merge main into fix/an-image-whose-recode-fails-is-written-without 2026-11-14 21:59:05 -08: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 119ce7942b PDF export: an image whose colors can't be converted is left out with a warning
When the Output settings convert colors, an image whose pixels can't be
decoded or written in the destination's colors was written as it was, in
its own colors: a CMYK image with more pixels than CMYK inks are read for,
or a color image the writer could embed but the decoder could not read.
In PDF/X-1a that could also write a color space the standard forbids.

Such an image is now left out with the warning "an image couldn't be
converted to the Output destination and is missing from the picture".
Gray images, whose pixels are not converted, and files that convert no
colors keep the image as before. An image that can't be written at all
still gets the warning that it couldn't be decoded.
2026-11-14 18:42:17 -08: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
Dylan M. Taylor 08305948cf style: cargo fmt 2026-11-14 23:25:19 +00:00
Dylan M. Taylor 1306afb5e8 Cut over roxmltree, png, tiff, psd, and trace codecs to craft-libs (#7638) 2026-11-14 23:25:19 +00: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