From dd303e9df7658055b5b880c318472aab14677b1d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 11:15:16 -0800 Subject: [PATCH] Overprint: a white spot ink keeps overprinting with Discard White Overprint on Discard White Overprint knocked out every white fill, stroke and character that was set to overprint, including a white linked to a spot swatch such as an opaque white ink. A white linked to a solid spot swatch at a tint above 0% is an ink of its own, so it now keeps overprinting; only paper white knocks out, a 0% tint of a spot swatch included. The rule is in vectorcraft_doc::overprint (DiscardWhite, is_paper_white) and is used by PDF export, Overprint Preview, Separations Preview, printed separations, the fills and strokes of composite print with Overprints set to Simulate, and Print Ink Fixes' Remove White Overprint. Overprint Preview and Separations Preview also draw overprinting paper white characters knocking out while the option is on, as PDF export already wrote them. EPS export keeps every overprint, as before. --- crates/doc/src/overprint.rs | 97 ++++++++++++++++++- crates/engine/src/cmd/addons/color.rs | 2 +- .../src/cmd/addons/color/print_fixes.rs | 29 +++--- .../src/cmd/addons/color/print_fixes/tests.rs | 14 +++ crates/engine/src/cmd/fileio/pdf.rs | 2 +- crates/engine/src/tests/docsetup.rs | 7 ++ crates/pdf/src/export.rs | 3 + crates/pdf/src/export/exporter.rs | 1 + crates/pdf/src/export/nodes.rs | 28 ++++-- crates/pdf/src/print.rs | 6 +- crates/pdf/src/print/plates.rs | 16 +-- crates/pdf/src/tests/layers.rs | 22 +++++ crates/pdf/src/tests/print.rs | 43 +++++++- crates/render/src/proof.rs | 51 ++++++++-- crates/render/src/tests/memory.rs | 85 +++++++++++++++- docs/mcp.md | 13 ++- docs/target-app-parity.md | 3 +- 17 files changed, 369 insertions(+), 53 deletions(-) diff --git a/crates/doc/src/overprint.rs b/crates/doc/src/overprint.rs index 58f6b5abc2..c5631a9a44 100644 --- a/crates/doc/src/overprint.rs +++ b/crates/doc/src/overprint.rs @@ -2,6 +2,7 @@ //! over the inks below instead of knocking them out ([`crate::FillLayer::overprint`]). //! Edit → Edit Colors → Overprint Black sets it on black fills and strokes ([`OverprintBlack`]). +use std::collections::HashSet; use std::sync::Arc; use vectorcraft_color::{BlendMode, Color, GradientKind, Paint}; @@ -151,14 +152,14 @@ impl Node { /// mode of their own keep it), copying only the nodes on the way to them: on screen and on a /// printed plate this approximates their inks printing over the inks below. Darken keeps the /// stronger ink of each plate (and each additive channel), so a colour overprinting itself stays -/// that colour, where Multiply would darken it. With `discard_white` -/// (Document Setup → Discard White Overprint) white fills and strokes knock out instead. -pub fn darken_overprints(a: &mut Arc, discard_white: bool) { +/// that colour, where Multiply would darken it. Fills and strokes that `discard_white` knocks out +/// (Document Setup → Discard White Overprint) are left as they are. +pub fn darken_overprints(a: &mut Arc, discard_white: &DiscardWhite) { if !a.has_overprint() { return; } let n = Arc::make_mut(a); - let darkens = |overprint: bool, blend: BlendMode, paint: &Paint| overprint && blend == BlendMode::Normal && !(discard_white && is_white(paint)); + let darkens = |overprint: bool, blend: BlendMode, paint: &Paint| overprint && blend == BlendMode::Normal && !discard_white.knocks_out(paint); for it in &mut n.appearance.items { match it { crate::AppearanceItem::Fill(l) if darkens(l.overprint, l.blend, &l.paint) => l.blend = BlendMode::Darken, @@ -182,7 +183,45 @@ pub fn is_white(p: &Paint) -> bool { } } +/// Whether `p` is paper white: white ([`is_white`]) and not a tint above 0% of one of the spot +/// swatches `spots` ([`Document::spot_ink_names`]). The white of a spot swatch (an opaque white +/// ink, for example) is an ink of its own; a 0% tint puts no ink down. +pub fn is_paper_white(p: &Paint, spots: &HashSet) -> bool { + is_white(p) && !matches!(p, Paint::Solid { swatch: Some(name), tint, .. } if *tint > 0.0 && spots.contains(name)) +} + +/// Document Setup → Discard White Overprint as it applies to paints: off, or on with the names of +/// the document's spot swatches. Paper white ([`is_paper_white`]) knocks out where it overprints; +/// a white spot ink keeps overprinting. Clones share the names. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct DiscardWhite(Option>>); + +impl DiscardWhite { + /// The setting of document `doc`. + pub fn of(doc: &Document) -> Self { + Self::printing(doc, |_| true) + } + + /// The setting of document `doc` when only the spot inks for which `spot` is true print as + /// spot inks: a white of another one (converted to process inks) is paper white. + pub fn printing(doc: &Document, spot: impl Fn(&str) -> bool) -> Self { + Self(doc.setup.discard_white_overprint.then(|| Arc::new(doc.spot_ink_names().into_iter().filter(|n| spot(n)).collect()))) + } + + /// Whether `p` knocks out instead of overprinting. + pub fn knocks_out(&self, p: &Paint) -> bool { + self.0.as_ref().is_some_and(|spots| is_paper_white(p, spots)) + } +} + impl Document { + /// The names of the spot swatches that a color linked by name prints as: a name whose first + /// swatch ([`Document::swatch`]) is not a solid spot color is left out. + pub fn spot_ink_names(&self) -> HashSet { + let mut seen = HashSet::new(); + self.swatches_iter().filter(|s| seen.insert(s.name.as_str()) && s.spot && s.paint.color().is_some()).map(|s| s.name.clone()).collect() + } + /// The names of the spot swatches. pub fn spot_names(&self) -> Vec { self.swatches_iter().filter(|s| s.spot).map(|s| s.name.clone()).collect() @@ -331,6 +370,56 @@ mod tests { assert!(OverprintBlack { spot: true, ..Default::default() }.apply(&mut n, &spots), "Include Spot Blacks takes it"); } + #[test] + fn a_white_spot_ink_overprints_under_discard_white() { + let mut d = Document::new(100.0, 100.0); + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + d.swatches.push(vectorcraft_color::Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true }); + d.swatches.push(vectorcraft_color::Swatch { name: "Process White".into(), paint: Paint::solid(white), global: true, spot: false }); + let spot = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 }; + let process = Paint::Solid { color: white, swatch: Some("Process White".into()), tint: 1.0 }; + let paper = Paint::solid(white); + assert!(d.setup.discard_white_overprint, "on by default"); + d.swatches.push(vectorcraft_color::Swatch { + name: "Red Ink".into(), + paint: Paint::solid(Color::cmyk(0.0, 1.0, 1.0, 0.0)), + global: true, + spot: true, + }); + // A 0% tint of a spot ink resolves to white and puts no ink down. + let no_red = Paint::Solid { color: white, swatch: Some("Red Ink".into()), tint: 0.0 }; + let no_white = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 0.0 }; + let half_white = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 0.5 }; + let discard = DiscardWhite::of(&d); + assert!(discard.knocks_out(&paper), "paper white knocks out"); + assert!(discard.knocks_out(&process), "so does a global process white"); + assert!(!discard.knocks_out(&spot) && !discard.knocks_out(&half_white), "a white spot ink is an ink"); + assert!(discard.knocks_out(&no_red) && discard.knocks_out(&no_white), "a 0% tint of a spot ink is paper white"); + assert!(!is_paper_white(&spot, &d.spot_ink_names()) && is_paper_white(&paper, &d.spot_ink_names())); + // A spot swatch after a process one of the same name: a link finds the process one. + d.swatches.push(vectorcraft_color::Swatch { name: "Process White".into(), paint: Paint::solid(white), global: true, spot: true }); + assert!(DiscardWhite::of(&d).knocks_out(&process), "the first swatch of the name decides"); + // A spot swatch without a solid color prints a linked solid as its own process color. + d.swatches.push(vectorcraft_color::Swatch { name: "Empty".into(), paint: Paint::None, global: true, spot: true }); + let empty = Paint::Solid { color: white, swatch: Some("Empty".into()), tint: 1.0 }; + assert!(DiscardWhite::of(&d).knocks_out(&empty), "so it is paper white"); + d.setup.discard_white_overprint = false; + assert!(!DiscardWhite::of(&d).knocks_out(&paper), "off: white overprints too"); + + // The previews and plates darken the spot ink and leave paper white knocking out. + let blend = |fill: Paint| { + let mut n = Node::path(NodeId(1), Default::default(), Appearance::basic(fill, Paint::None, 0.0)); + if let Some(f) = n.appearance.fill_mut() { + f.overprint = true; + } + let mut a = Arc::new(n); + darken_overprints(&mut a, &discard); + a.appearance.fill().map(|f| f.blend) + }; + assert_eq!(blend(spot), Some(BlendMode::Darken)); + assert_eq!(blend(paper), Some(BlendMode::Normal)); + } + #[test] fn apply_deep_copies_only_the_nodes_that_change() { let k = cmyk(0.0, 0.0, 0.0, 1.0); diff --git a/crates/engine/src/cmd/addons/color.rs b/crates/engine/src/cmd/addons/color.rs index 703d81ddc3..d80a3c0e5c 100644 --- a/crates/engine/src/cmd/addons/color.rs +++ b/crates/engine/src/cmd/addons/color.rs @@ -52,7 +52,7 @@ pub fn specs() -> Vec { "Print Ink Fixes", ["Object", "Plug-ins", "Color Effects"], None, - "{scope?: \"selection\" (the selection, or `ids`; by default, the document while nothing is selected) | \"document\" (every layer), inkLimit?: total ink % 1..400 (0 or left out: off), excludePureBlack?: true (black-only and grey colours keep their ink), removeWhiteOverprint?: false (white fills and strokes stop overprinting), overprintBlack?: black % 1..100 (black-only and grey fills and strokes this dark or darker overprint, as edit.colors.overprintBlack; 0 or left out: off), textOnly?: false (Overprint Black on type only), fill?: true, stroke?: true, ids?: [id…]} prepare a CMYK document's inks for print as one undo step: CMYK colours (solid, gradient stops, gradient meshes) with more total ink than inkLimit are scaled down to it (colours of spot swatches and Registration stay), white overprint is removed and black overprint set. Refused in RGB documents (File › Document Color Mode › CMYK Color first). On a path directly in a graph series, the graph also stores a paint the ink limit changes on the topmost visible fill or stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, inkLimited: paints and meshes scaled, whiteOverprintRemoved: objects, blackOverprinted: objects}", + "{scope?: \"selection\" (the selection, or `ids`; by default, the document while nothing is selected) | \"document\" (every layer), inkLimit?: total ink % 1..400 (0 or left out: off), excludePureBlack?: true (black-only and grey colours keep their ink), removeWhiteOverprint?: false (white fills and strokes stop overprinting; a white linked to a spot swatch at a tint above 0% is an ink and keeps it), overprintBlack?: black % 1..100 (black-only and grey fills and strokes this dark or darker overprint, as edit.colors.overprintBlack; 0 or left out: off), textOnly?: false (Overprint Black on type only), fill?: true, stroke?: true, ids?: [id…]} prepare a CMYK document's inks for print as one undo step: CMYK colours (solid, gradient stops, gradient meshes) with more total ink than inkLimit are scaled down to it (colours of spot swatches and Registration stay), white overprint is removed and black overprint set. Refused in RGB documents (File › Document Color Mode › CMYK Color first). On a path directly in a graph series, the graph also stores a paint the ink limit changes on the topmost visible fill or stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, inkLimited: paints and meshes scaled, whiteOverprintRemoved: objects, blackOverprinted: objects}", has_doc, print_fixes::run ), diff --git a/crates/engine/src/cmd/addons/color/print_fixes.rs b/crates/engine/src/cmd/addons/color/print_fixes.rs index c5f430eb76..5348a621ec 100644 --- a/crates/engine/src/cmd/addons/color/print_fixes.rs +++ b/crates/engine/src/cmd/addons/color/print_fixes.rs @@ -1,14 +1,15 @@ //! Print Ink Fixes (`addon.color.printFixes`, Object › Plug-ins › Color Effects › Print Ink //! Fixes…): a CMYK document's inks made ready for print in one undo step. Colours with more total -//! ink than the limit are scaled down to it, white fills and strokes stop overprinting, and black +//! ink than the limit are scaled down to it, paper white fills and strokes stop overprinting, and black //! ones start to, as Edit › Edit Colors › Overprint Black sets it. +use std::collections::HashSet; use std::sync::Arc; use serde_json::{Value, json}; use vectorcraft_color::Color; use vectorcraft_color::swatch::REGISTRATION; -use vectorcraft_doc::overprint::{OverprintBlack, is_white}; +use vectorcraft_doc::overprint::{OverprintBlack, is_paper_white}; use vectorcraft_doc::{ColorMode, Node, NodeKind}; use super::super::super::colorcmds::{Recolor, Scope, keeping_series_paint}; @@ -78,8 +79,9 @@ impl Fixes { } /// Remove white overprint from `n`'s own fills and strokes and its characters': true when - /// that changed anything. - fn unset_white(&self, n: &mut Node) -> bool { + /// that changed anything. A white linked to one of the spot inks `inks` is an ink and keeps + /// overprinting ([`is_paper_white`]). + fn unset_white(&self, n: &mut Node, inks: &HashSet) -> bool { let mut changed = false; let mut off = |aimed: bool, white: bool, flag: &mut bool| { if aimed && white && *flag { @@ -89,26 +91,27 @@ impl Fixes { }; for it in &mut n.appearance.items { let aimed = if it.is_fill() { self.fill } else { self.stroke }; - let white = is_white(it.paint()); + let white = is_paper_white(it.paint(), inks); off(aimed, white, it.overprint_mut()); } if let NodeKind::Text(t) = &mut n.kind { for r in &mut t.runs { - off(self.fill, is_white(&r.style.fill), &mut r.style.overprint_fill); - off(self.stroke, is_white(&r.style.stroke), &mut r.style.overprint_stroke); + off(self.fill, is_paper_white(&r.style.fill, inks), &mut r.style.overprint_fill); + off(self.stroke, is_paper_white(&r.style.stroke, inks), &mut r.style.overprint_stroke); } } changed } /// The overprint fixes on `n` and everything inside it: (objects whose white overprint was - /// removed, objects set to overprint black). - fn overprint(&self, n: &mut Node, black: &OverprintBlack, spots: &[String]) -> (usize, usize) { - let white = usize::from(self.remove_white_overprint && self.unset_white(n)); + /// removed, objects set to overprint black). `spots`: the document's spot swatch names; `inks`: + /// those that linked colors print as ([`vectorcraft_doc::Document::spot_ink_names`]). + fn overprint(&self, n: &mut Node, black: &OverprintBlack, spots: &[String], inks: &HashSet) -> (usize, usize) { + let white = usize::from(self.remove_white_overprint && self.unset_white(n, inks)); let blacks = self.overprint_black > 0.0 && (!self.text_only || matches!(n.kind, NodeKind::Text(_))); let mut counts = (white, usize::from(blacks && black.apply(n, spots))); for c in n.children_mut().into_iter().flatten().filter(|c| !c.is_ruler_guide()) { - let (w, b) = self.overprint(Arc::make_mut(c), black, spots); + let (w, b) = self.overprint(Arc::make_mut(c), black, spots, inks); counts = (counts.0 + w, counts.1 + b); } counts @@ -154,10 +157,10 @@ pub(super) fn run(s: &mut Session, p: &Value) -> Result { if !fixes.remove_white_overprint && fixes.overprint_black <= 0.0 { return Ok(ink); } - let spots = d.spot_names(); + let (spots, inks) = (d.spot_names(), d.spot_ink_names()); for id in &ids { if let Some(n) = d.node_mut(*id) { - let (w, b) = fixes.overprint(n, &black, &spots); + let (w, b) = fixes.overprint(n, &black, &spots, &inks); (white, blacks) = (white + w, blacks + b); } } diff --git a/crates/engine/src/cmd/addons/color/print_fixes/tests.rs b/crates/engine/src/cmd/addons/color/print_fixes/tests.rs index e4c1915879..8e28701572 100644 --- a/crates/engine/src/cmd/addons/color/print_fixes/tests.rs +++ b/crates/engine/src/cmd/addons/color/print_fixes/tests.rs @@ -101,6 +101,20 @@ fn white_overprint_goes_and_black_overprint_comes_at_the_threshold() { assert_eq!(s.execute(C, &json!({"overprintBlack": 90, "fill": false})).unwrap()["changed"], 0); } +#[test] +fn a_white_spot_ink_keeps_its_overprint() { + let white = cmyk(0.0, 0.0, 0.0, 0.0); + let (mut s, ids) = doc(&[(white.clone(), true), (white.clone(), true)]); + s.execute("swatch.new", &json!({"name": "Opaque White", "color": white, "spot": true})).unwrap(); + s.execute("select.set", &json!({"ids": [ids[1].0]})).unwrap(); + s.execute("paint.setFill", &json!({"swatch": "Opaque White"})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + assert!(fill(&s, ids[1]).1, "the swatch keeps the overprint"); + let v = s.execute(C, &json!({"removeWhiteOverprint": true})).unwrap(); + assert_eq!(v["whiteOverprintRemoved"], 1, "{v}"); + assert_eq!([fill(&s, ids[0]).1, fill(&s, ids[1]).1], [false, true], "paper white stops; the spot white is an ink"); +} + #[test] fn bad_requests_and_rgb_documents_are_refused() { let (mut s, ids) = doc(&[(cmyk(100.0, 100.0, 100.0, 100.0), true)]); diff --git a/crates/engine/src/cmd/fileio/pdf.rs b/crates/engine/src/cmd/fileio/pdf.rs index c0bb942150..7927479f4b 100644 --- a/crates/engine/src/cmd/fileio/pdf.rs +++ b/crates/engine/src/cmd/fileio/pdf.rs @@ -128,7 +128,7 @@ pub fn specs() -> Vec { "Export PDF", [], None, - "{path?, preset?: \"VectorCraft Default\" (built-in or saved: pdf.preset.list), artboard? | artboards?: [i…] | range?: \"1-3, 5\" (1-based; default all, one page each), useArtboards?: true (false: one page, the bounds of the visible art the page draws (non-printing layers left out unless includeNonPrinting or createLayers keeps them), as document.export writes it; artboard, artboards and range are then ignored, Preserve Editing is left out (with a warning when it is on), and a document with no visible art is refused), standard?: none|pdfA2b|pdfX1a (CMYK, grey and spot colours only: colours and images converted to output.destination or the CMYK output intent, untagged; transparency flattened with flattenerPreset; PDF 1.3)|pdfX3 (colours ICC-tagged, CMYK in the output intent's profile as DeviceCMYK; transparency flattened; PDF 1.3)|pdfX4 (transparency and layers kept; colours ICC-tagged, CMYK in the output intent's profile as DeviceCMYK; PDF 1.6 at most) (PDF/X: a /GTS_PDFX output intent, by default the CMYK profile in effect, embedded; TrimBox, Trapped, GTS_PDFXVersion, title and dates; fonts embedded or outlined), compatibility?: 1.3 (no transparency: it is flattened with flattenerPreset, without the layers the file leaves out; images keep no see-through pixels)|1.4|1.5|1.6|1.7 (default)|2.0 (choosing a standard sets its version: 1.7 for pdfA2b, 1.6 for pdfX4, 1.3 for pdfX1a and pdfX3, which write 1.4 as 1.3 too; pdfA2b refuses 1.3; in pdfA2b files, and with longPagesInPoints: false, a page with a side longer than 14,400 pt keeps its size with a UserUnit from 1.6 on: 1.5 is then written as 1.6, with 1.5's encryption, and so is 1.4 in pdfA2b files, with a warning; PDF/X files and other 1.3 and 1.4 files write it in points, and 1.3 and 1.4 (pdfX1a and pdfX3 too) refuse a page past 32,767 pt whose size or art needs a real number past 32,767; a page whose short side is 3 pt or longer but would be under 3 units at that UserUnit gets a smaller one that keeps the short side at 3 units; a warning gives each such page's size), longPagesInPoints?: true (such a page is written at its size in points, without a UserUnit, at every version, and 1.5 stays 1.5, in files without a standard (PDF/A files keep the UserUnit); apps that keep to the limit cut it to 200 in; false: the UserUnit as above, with a warning that names this option), preserveEditing? (on in VectorCraft Default: the native document as an embedded file, which document.open restores; choosing a standard turns it off, a standard refuses it), thumbnails? (each page drawn as a /Thumb image, 106 px on its long side), fastWebView? (a linearised file: the first page shows while the rest downloads; it stays linearised when encrypted), viewAfterSaving? (the app opens the written file), createLayers? (each layer and sublayer but template layers as a PDF layer, an optional content group listed under its layer's: hidden layers off, non-printing ones /PrintState /OFF, locked ones locked; needs 1.5 or later; they reopen as layers; choosing pdfX1a or pdfX3 turns it off; they refuse it), includeNonPrinting? (keep layers whose Print option is off; left out by default unless createLayers), flattenerPreset?: \"\" (High Resolution) | high | medium | low | a saved preset (flattener.presets.list): what PDF 1.3 files flatten transparency with, flattener?: {object.flattenTransparency options over it}, compression?: {color?, gray?: {downsample: none|average|subsample|bicubic, ppi: 300, abovePpi: 450, compression: none|zip|jpeg|jpeg2000|auto, quality: minimum|low|medium|high|maximum}, mono?: {downsample, ppi: 1200, abovePpi: 1800, compression: none|ccittG3|ccittG4|zip|runLength} (black-and-white images), compressText?: true} (images above abovePpi are resampled to ppi; auto keeps JPEGs JPEG, the others lossless; JPEG needs opaque images; none, jpeg2000, CCITT and runLength are written as ZIP with a warning), marks?: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25 (trim marks and targets), offset: 6 (pt from the artboard, at least the bleed)} (printer's marks in [Registration], every plate: trim marks, registration targets mid-side, CMYK/spot/black-tint colour bars on top, page information (title, artboard, date UTC) below), bleed?: {useDocument (the document's bleed, document.setup), top, bottom, left, right} (pt; art in the bleed is kept; a PDF/X file with no bleed on a side where the document's bleed has one comes back with a warning, and so does a count of the visible objects that reach the trim edge (within 0.5 pt) on a side with a bleed but end before the bleed edge; layers that don't print are left out unless includeNonPrinting, and art and boxes are written unchanged). Each page: TrimBox = artboard, BleedBox = artboard + bleed, MediaBox = that + the marks' room (art clipped to the BleedBox), output?: {conversion: none (default)|destination (every colour into the destination profile's model, CMYK or RGB, also colours of that model in another profile)|preserveNumbers (only colours of the other model and Lab; those in the destination's model keep their numbers) (grey stays grey; images are converted too, and with destination and an sRGB destination a gray or RGB image tagged with an ICC profile is converted from it and written untagged; with destination and a CMYK destination, or another RGB one images are converted to (not when colours are ICC-tagged), an RGB image tagged with one is converted from it through sRGB; with preserveNumbers (and pdfX1a) only untagged images keep their numbers: an RGB image tagged with one is converted from it to sRGB or through sRGB to the destination, and a gray one is converted from it in an sRGB destination; any other image whose colors are converted (a CMYK image, an RGB one going to a CMYK destination, or with destination to an RGB one other than sRGB) but whose pixels can't be decoded or written that way is left out with a warning; printer's marks are not), destination: profile name (edit.colorSettings lists them; default: the document's profile for its colour mode), profiles: none (device colours; images are written without the ICC profiles they carry, a JPEG without its ICC_PROFILE segments, but in PDF/A, pdfX3 and pdfX4)|all|destination|taggedSource (documents assigned a profile: edit.assignProfile)|default (not set, the default; \"default\" unsets a preset's value, null keeps it: device colours, and gray and RGB images keep the profiles they carry, but in pdfX1a) (ICC-based colours: CMYK with the destination or document CMYK profile, RGB as sRGB, grey with the sRGB tone curve; PDF/A, pdfX3 and pdfX4 always, whatever profiles says, but in pdfX3 and pdfX4 CMYK colors in the profile of a CMYK output intent are DeviceCMYK, and with none and a CMYK output intent pdfX3 and pdfX4 write every CMYK color as DeviceCMYK, unless colors are converted to a CMYK destination of another profile; a CMYK image that keeps its numbers carries the CMYK profile it embeds with all and taggedSource, and in PDF/A, pdfX3 and pdfX4 unless destination, never in pdfX1a, nor when CMYK colors are DeviceCMYK and either its profile is the output intent's or profiles is none), outputIntent: profile name (embedded as the catalog's /GTS_PDFX output intent; a name that isn't a profile is only named, which pdfX1a and pdfX3 allow only with a registry and pdfX4 refuses; pdfX1a needs a CMYK one), outputCondition, outputConditionId (default: outputIntent), registry, trapped (/Trapped /True; /False when an output intent is written)} (PDF/A files keep their own output intent), advanced?: {fontSubsetPercent: 100 (below 100 is accepted with a warning: fonts are always embedded as subsets), outlineText: false (type as real, selectable and searchable text in embedded subset fonts with a ToUnicode map; fonts whose licence forbids embedding, or allows only whole fonts, stay outlines with a warning; true: every glyph as an outline), overprint: preserve (overprinting fills and strokes set /OP /op true, /OPM 1; white ones knock out with document.setup discardWhiteOverprint)|discard (they knock out)}, security?: {openPassword, permissionsPassword, printing: none|low|high, changes: none|pages|forms|comments|any, copy, screenReader, plaintextMetadata}, acknowledgeLoss?: bool (write over the file the document was read from although reading it left things out), format?: \"pdf\"} → {path, bytes, warnings}; no path → {dataBase64, bytes, warnings}. The options apply over the preset (null keeps its value); options accepted but not applied yet come back as warnings; a standard with a PDF version it doesn't allow and a password with a standard are refused, and so is a PDF/X file that would still break its standard (transparency the flattener left, RGB in pdfX1a, a font not embedded) or a PDF 1.3 file with transparency left. document.export {format: pdf} takes the same options. A key PDF doesn't take, and an unknown key inside one of the option objects, are refused. Under automation read roots, a PDF that carries the native document (preserveEditing on, every artboard, useArtboards not false) is refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked)", + "{path?, preset?: \"VectorCraft Default\" (built-in or saved: pdf.preset.list), artboard? | artboards?: [i…] | range?: \"1-3, 5\" (1-based; default all, one page each), useArtboards?: true (false: one page, the bounds of the visible art the page draws (non-printing layers left out unless includeNonPrinting or createLayers keeps them), as document.export writes it; artboard, artboards and range are then ignored, Preserve Editing is left out (with a warning when it is on), and a document with no visible art is refused), standard?: none|pdfA2b|pdfX1a (CMYK, grey and spot colours only: colours and images converted to output.destination or the CMYK output intent, untagged; transparency flattened with flattenerPreset; PDF 1.3)|pdfX3 (colours ICC-tagged, CMYK in the output intent's profile as DeviceCMYK; transparency flattened; PDF 1.3)|pdfX4 (transparency and layers kept; colours ICC-tagged, CMYK in the output intent's profile as DeviceCMYK; PDF 1.6 at most) (PDF/X: a /GTS_PDFX output intent, by default the CMYK profile in effect, embedded; TrimBox, Trapped, GTS_PDFXVersion, title and dates; fonts embedded or outlined), compatibility?: 1.3 (no transparency: it is flattened with flattenerPreset, without the layers the file leaves out; images keep no see-through pixels)|1.4|1.5|1.6|1.7 (default)|2.0 (choosing a standard sets its version: 1.7 for pdfA2b, 1.6 for pdfX4, 1.3 for pdfX1a and pdfX3, which write 1.4 as 1.3 too; pdfA2b refuses 1.3; in pdfA2b files, and with longPagesInPoints: false, a page with a side longer than 14,400 pt keeps its size with a UserUnit from 1.6 on: 1.5 is then written as 1.6, with 1.5's encryption, and so is 1.4 in pdfA2b files, with a warning; PDF/X files and other 1.3 and 1.4 files write it in points, and 1.3 and 1.4 (pdfX1a and pdfX3 too) refuse a page past 32,767 pt whose size or art needs a real number past 32,767; a page whose short side is 3 pt or longer but would be under 3 units at that UserUnit gets a smaller one that keeps the short side at 3 units; a warning gives each such page's size), longPagesInPoints?: true (such a page is written at its size in points, without a UserUnit, at every version, and 1.5 stays 1.5, in files without a standard (PDF/A files keep the UserUnit); apps that keep to the limit cut it to 200 in; false: the UserUnit as above, with a warning that names this option), preserveEditing? (on in VectorCraft Default: the native document as an embedded file, which document.open restores; choosing a standard turns it off, a standard refuses it), thumbnails? (each page drawn as a /Thumb image, 106 px on its long side), fastWebView? (a linearised file: the first page shows while the rest downloads; it stays linearised when encrypted), viewAfterSaving? (the app opens the written file), createLayers? (each layer and sublayer but template layers as a PDF layer, an optional content group listed under its layer's: hidden layers off, non-printing ones /PrintState /OFF, locked ones locked; needs 1.5 or later; they reopen as layers; choosing pdfX1a or pdfX3 turns it off; they refuse it), includeNonPrinting? (keep layers whose Print option is off; left out by default unless createLayers), flattenerPreset?: \"\" (High Resolution) | high | medium | low | a saved preset (flattener.presets.list): what PDF 1.3 files flatten transparency with, flattener?: {object.flattenTransparency options over it}, compression?: {color?, gray?: {downsample: none|average|subsample|bicubic, ppi: 300, abovePpi: 450, compression: none|zip|jpeg|jpeg2000|auto, quality: minimum|low|medium|high|maximum}, mono?: {downsample, ppi: 1200, abovePpi: 1800, compression: none|ccittG3|ccittG4|zip|runLength} (black-and-white images), compressText?: true} (images above abovePpi are resampled to ppi; auto keeps JPEGs JPEG, the others lossless; JPEG needs opaque images; none, jpeg2000, CCITT and runLength are written as ZIP with a warning), marks?: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25 (trim marks and targets), offset: 6 (pt from the artboard, at least the bleed)} (printer's marks in [Registration], every plate: trim marks, registration targets mid-side, CMYK/spot/black-tint colour bars on top, page information (title, artboard, date UTC) below), bleed?: {useDocument (the document's bleed, document.setup), top, bottom, left, right} (pt; art in the bleed is kept; a PDF/X file with no bleed on a side where the document's bleed has one comes back with a warning, and so does a count of the visible objects that reach the trim edge (within 0.5 pt) on a side with a bleed but end before the bleed edge; layers that don't print are left out unless includeNonPrinting, and art and boxes are written unchanged). Each page: TrimBox = artboard, BleedBox = artboard + bleed, MediaBox = that + the marks' room (art clipped to the BleedBox), output?: {conversion: none (default)|destination (every colour into the destination profile's model, CMYK or RGB, also colours of that model in another profile)|preserveNumbers (only colours of the other model and Lab; those in the destination's model keep their numbers) (grey stays grey; images are converted too, and with destination and an sRGB destination a gray or RGB image tagged with an ICC profile is converted from it and written untagged; with destination and a CMYK destination, or another RGB one images are converted to (not when colours are ICC-tagged), an RGB image tagged with one is converted from it through sRGB; with preserveNumbers (and pdfX1a) only untagged images keep their numbers: an RGB image tagged with one is converted from it to sRGB or through sRGB to the destination, and a gray one is converted from it in an sRGB destination; any other image whose colors are converted (a CMYK image, an RGB one going to a CMYK destination, or with destination to an RGB one other than sRGB) but whose pixels can't be decoded or written that way is left out with a warning; printer's marks are not), destination: profile name (edit.colorSettings lists them; default: the document's profile for its colour mode), profiles: none (device colours; images are written without the ICC profiles they carry, a JPEG without its ICC_PROFILE segments, but in PDF/A, pdfX3 and pdfX4)|all|destination|taggedSource (documents assigned a profile: edit.assignProfile)|default (not set, the default; \"default\" unsets a preset's value, null keeps it: device colours, and gray and RGB images keep the profiles they carry, but in pdfX1a) (ICC-based colours: CMYK with the destination or document CMYK profile, RGB as sRGB, grey with the sRGB tone curve; PDF/A, pdfX3 and pdfX4 always, whatever profiles says, but in pdfX3 and pdfX4 CMYK colors in the profile of a CMYK output intent are DeviceCMYK, and with none and a CMYK output intent pdfX3 and pdfX4 write every CMYK color as DeviceCMYK, unless colors are converted to a CMYK destination of another profile; a CMYK image that keeps its numbers carries the CMYK profile it embeds with all and taggedSource, and in PDF/A, pdfX3 and pdfX4 unless destination, never in pdfX1a, nor when CMYK colors are DeviceCMYK and either its profile is the output intent's or profiles is none), outputIntent: profile name (embedded as the catalog's /GTS_PDFX output intent; a name that isn't a profile is only named, which pdfX1a and pdfX3 allow only with a registry and pdfX4 refuses; pdfX1a needs a CMYK one), outputCondition, outputConditionId (default: outputIntent), registry, trapped (/Trapped /True; /False when an output intent is written)} (PDF/A files keep their own output intent), advanced?: {fontSubsetPercent: 100 (below 100 is accepted with a warning: fonts are always embedded as subsets), outlineText: false (type as real, selectable and searchable text in embedded subset fonts with a ToUnicode map; fonts whose licence forbids embedding, or allows only whole fonts, stay outlines with a warning; true: every glyph as an outline), overprint: preserve (overprinting fills and strokes set /OP /op true, /OPM 1; white ones not linked to a spot swatch at a tint above 0% knock out with document.setup discardWhiteOverprint)|discard (they knock out)}, security?: {openPassword, permissionsPassword, printing: none|low|high, changes: none|pages|forms|comments|any, copy, screenReader, plaintextMetadata}, acknowledgeLoss?: bool (write over the file the document was read from although reading it left things out), format?: \"pdf\"} → {path, bytes, warnings}; no path → {dataBase64, bytes, warnings}. The options apply over the preset (null keeps its value); options accepted but not applied yet come back as warnings; a standard with a PDF version it doesn't allow and a password with a standard are refused, and so is a PDF/X file that would still break its standard (transparency the flattener left, RGB in pdfX1a, a font not embedded) or a PDF 1.3 file with transparency left. document.export {format: pdf} takes the same options. A key PDF doesn't take, and an unknown key inside one of the option objects, are refused. Under automation read roots, a PDF that carries the native document (preserveEditing on, every artboard, useArtboards not false) is refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked)", has_doc, export_pdf ), diff --git a/crates/engine/src/tests/docsetup.rs b/crates/engine/src/tests/docsetup.rs index 21dd990087..d2b6a1d839 100644 --- a/crates/engine/src/tests/docsetup.rs +++ b/crates/engine/src/tests/docsetup.rs @@ -492,6 +492,13 @@ fn discard_white_overprint_keeps_white_overprints_in_overprint_preview() { s.execute("document.setup", &json!({"discardWhiteOverprint": false})).unwrap(); let [r, g, b, _] = centre(&s); assert!(r > 200 && g < 60 && b < 60, "a white overprint vanishes: {:?}", [r, g, b]); + // A white spot ink is an ink: it overprints with the option on too. + s.execute("document.setup", &json!({"discardWhiteOverprint": true})).unwrap(); + s.execute("swatch.new", &json!({"name": "Opaque White", "color": {"c": 0, "m": 0, "y": 0, "k": 0}, "spot": true})).unwrap(); + s.execute("select.set", &json!({"ids": [white]})).unwrap(); + s.execute("paint.setFill", &json!({"swatch": "Opaque White"})).unwrap(); + let [r, g, b, _] = centre(&s); + assert!(r > 200 && g < 60 && b < 60, "the spot white overprints: {:?}", [r, g, b]); } #[test] diff --git a/crates/pdf/src/export.rs b/crates/pdf/src/export.rs index 094cdeb99d..501eeee2a9 100644 --- a/crates/pdf/src/export.rs +++ b/crates/pdf/src/export.rs @@ -114,6 +114,9 @@ pub(crate) struct Exporter<'a> { /// Overprinting characters' fills and strokes are drawn with Darken, as a separation's plate /// draws its overprinting fills and strokes ([`vectorcraft_doc::overprint::darken_overprints`]). pub darken_overprints: bool, + /// Document Setup → Discard White Overprint as it applies to the document's paints, read from + /// the document on first use ([`Self::discards_white`]). + discard_white: Option, /// An overprinting fill or stroke was drawn so. pub overprinted: bool, /// Characters with neither fill nor stroke, or whose fill is drawn as art (outlines filled diff --git a/crates/pdf/src/export/exporter.rs b/crates/pdf/src/export/exporter.rs index 498c12ca04..c1fc8defe7 100644 --- a/crates/pdf/src/export/exporter.rs +++ b/crates/pdf/src/export/exporter.rs @@ -64,6 +64,7 @@ impl<'a> Exporter<'a> { mask_art_left_out: false, overprint: false, darken_overprints: false, + discard_white: None, overprinted: false, invisible: false, inline_depth: 0, diff --git a/crates/pdf/src/export/nodes.rs b/crates/pdf/src/export/nodes.rs index d84e8f7124..e18b581fa7 100644 --- a/crates/pdf/src/export/nodes.rs +++ b/crates/pdf/src/export/nodes.rs @@ -620,11 +620,10 @@ impl Exporter<'_> { } /// Draw a fill or stroke of `paint` with `draw`: as a form marked to overprint when it - /// `overprints`, paints and overprints are kept (but not a white one with Discard White - /// Overprint). + /// `overprints`, paints and overprints are kept (but not a paper white one with Discard White + /// Overprint, [`Self::discards_white`]). pub(super) fn overprinting(&mut self, s: &mut Surface, overprints: bool, paint: &Paint, draw: impl FnOnce(&mut Self, &mut Surface)) { - let white = || self.doc.setup.discard_white_overprint && vectorcraft_doc::overprint::is_white(paint); - if overprints && self.overprint && !paint.is_none() && !white() { + if overprints && self.overprint && !paint.is_none() && !self.discards_white(paint) { self.overprinted = true; crate::forms::form(s, Mark::Overprint, |s| draw(self, s)); } else { @@ -633,11 +632,10 @@ impl Exporter<'_> { } /// [`Self::overprinting`] for a character fill or stroke, which has no blend mode of its own: - /// with [`Self::darken_overprints`] an overprinting one is drawn with Darken (not a white one - /// with Discard White Overprint). + /// with [`Self::darken_overprints`] an overprinting one is drawn with Darken (not a paper + /// white one with Discard White Overprint). pub(super) fn char_overprinting(&mut self, s: &mut Surface, overprints: bool, paint: &Paint, draw: impl FnOnce(&mut Self, &mut Surface)) { - let white = vectorcraft_doc::overprint::is_white(paint) && self.doc.setup.discard_white_overprint; - if overprints && self.darken_overprints && !paint.is_none() && !white { + if overprints && self.darken_overprints && !paint.is_none() && !self.discards_white(paint) { s.push_blend_mode(krilla::blend::BlendMode::Darken); self.overprinting(s, overprints, paint, draw); s.pop(); @@ -646,6 +644,20 @@ impl Exporter<'_> { } } + /// Whether paint `p` knocks out where it overprints under Document Setup → Discard White + /// Overprint ([`vectorcraft_doc::overprint::DiscardWhite::knocks_out`]). The document's spot + /// ink names are read only for a white linked to a swatch. + fn discards_white(&mut self, p: &Paint) -> bool { + let doc = self.doc; + if !doc.setup.discard_white_overprint || !vectorcraft_doc::overprint::is_white(p) { + return false; + } + if !matches!(p, Paint::Solid { swatch: Some(_), .. }) { + return true; + } + self.discard_white.get_or_insert_with(|| vectorcraft_doc::overprint::DiscardWhite::of(doc)).knocks_out(p) + } + /// Is `p` a paint PDF has no paint for when it paints a fill (`fill`) or a stroke, which /// [`Self::area`] draws as art: a pattern swatch or a gradient drawn as pixels /// ([`vectorcraft_color::GradientPaint::draws_as_pixels`]), but not a Perceptual one of spot diff --git a/crates/pdf/src/print.rs b/crates/pdf/src/print.rs index 6c619b3165..96ccc2c2f0 100644 --- a/crates/pdf/src/print.rs +++ b/crates/pdf/src/print.rs @@ -40,7 +40,7 @@ use kurbo::{Affine, Rect, Vec2}; use serde::Serialize; use vectorcraft_color::cms::{self, ProfileKind}; use vectorcraft_doc::marks::PrinterMarks; -use vectorcraft_doc::overprint::{OverprintBlack, clear_overprints, darken_overprints}; +use vectorcraft_doc::overprint::{DiscardWhite, OverprintBlack, clear_overprints, darken_overprints}; use vectorcraft_doc::{ColorMode, Document, Node, NodeKind}; pub use layout::{MAX_COPIES_PER_SHEET, MAX_TILES, TileGrid}; @@ -411,12 +411,12 @@ fn composite_overprints(doc: &mut Document, set: &PrintSettings) { if set.output.mode == OutputMode::Separations || how == PrintOverprints::Preserve { return; } - let discard_white = doc.setup.discard_white_overprint; + let discard_white = DiscardWhite::of(doc); let symbols = doc.symbols.iter_mut().map(|s| &mut s.art); let nodes = doc.layers.iter_mut().chain(symbols).chain(doc.patterns.iter_mut().flat_map(|p| p.art.iter_mut())); for n in nodes { if how == PrintOverprints::Simulate { - darken_overprints(n, discard_white); + darken_overprints(n, &discard_white); } clear_overprints(n); } diff --git a/crates/pdf/src/print/plates.rs b/crates/pdf/src/print/plates.rs index dada741c9d..92e0a16620 100644 --- a/crates/pdf/src/print/plates.rs +++ b/crates/pdf/src/print/plates.rs @@ -9,7 +9,7 @@ use vectorcraft_color::cms::{self, Cms, Model, ProfileKind}; use vectorcraft_color::swatch::REGISTRATION; use vectorcraft_color::{BlendMode, Color, GradientKind, GradientStop, Paint}; use vectorcraft_doc::inks::{Link, StopPlates, inks, plates, spot_color, stop_inks, visit_node_colors}; -use vectorcraft_doc::overprint::{darken_overprints, is_black_ink, is_white}; +use vectorcraft_doc::overprint::{DiscardWhite, darken_overprints, is_black_ink}; use vectorcraft_doc::{AppearanceItem, ColorMode, Document, ImageBlob, Node, NodeKind}; use super::{DEFAULT_FREQUENCY, InkSettings, PrintInk, PrintSettings}; @@ -236,15 +236,15 @@ impl<'a> Separator<'a> { /// Overprinting fills and strokes of `a`'s subtree with a Normal blending mode, and /// overprinting character fills and strokes, that put none of ink `plate` down leave its plate - /// as it is: they are drawn as nothing on it (white ones with `discard_white` aside, which - /// knock out). A writer without blending modes (PostScript) then keeps the ink below them, + /// as it is: they are drawn as nothing on it (paper white ones that `discard_white` knocks out + /// aside). A writer without blending modes (PostScript) then keeps the ink below them, /// where it would draw their Darken as a knockout. One that puts any ink down is drawn, and on /// a PostScript plate its ink replaces the ink below, as a nonzero component of an overprinting /// color replaces the backdrop's with overprint mode 1 (ISO 32000-1, 11.7.4.2). On a /// PostScript plate, the stops and points of such a gradient that put none of the ink down /// become paper white ([`Self::clear_inkless_stops`]), which the writer leaves out there. - fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc, discard_white: bool) { - let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !(discard_white && is_white(p)) && self.no_ink(plate, p); + fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc, discard_white: &DiscardWhite) { + let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !discard_white.knocks_out(p) && self.no_ink(plate, p); let n = Arc::make_mut(a); for it in &mut n.appearance.items { let normal = match it { @@ -281,12 +281,12 @@ impl<'a> Separator<'a> { /// ink the plate below shows through instead of being knocked out. pub fn plate(&self, plate: &str) -> Document { let mut d = self.doc.clone(); - let discard_white = d.setup.discard_white_overprint; + let discard_white = DiscardWhite::printing(&d, |n| !self.converts(n)); let mut colorized = BTreeSet::new(); let nodes = d.layers.iter_mut().chain(d.symbols.iter_mut().map(|s| &mut s.art)).chain(d.patterns.iter_mut().flat_map(|p| p.art.iter_mut())); for n in nodes { - self.clear_inkless_overprints(plate, n, discard_white); - darken_overprints(n, discard_white); + self.clear_inkless_overprints(plate, n, &discard_white); + darken_overprints(n, &discard_white); self.node(plate, Arc::make_mut(n)); keep_colorized_pixels(n, &d.images, &mut colorized); } diff --git a/crates/pdf/src/tests/layers.rs b/crates/pdf/src/tests/layers.rs index b11cbc47d8..d989337cee 100644 --- a/crates/pdf/src/tests/layers.rs +++ b/crates/pdf/src/tests/layers.rs @@ -352,6 +352,28 @@ fn white_overprint_is_discarded_as_the_document_setup_says() { assert_eq!(overprints(&d, json!({})).1, 3); } +#[test] +fn a_white_spot_ink_keeps_overprinting_under_discard_white_overprint() { + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + let mut d = overprinting(white); + d.swatches.push(vectorcraft_color::Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true }); + let paint = |d: &mut Document, p: &Paint| { + for n in std::sync::Arc::make_mut(&mut d.layers[0]).children_mut().into_iter().flatten() { + let n = std::sync::Arc::make_mut(n); + if let Some(f) = n.appearance.fill_mut().filter(|f| f.overprint) { + f.paint = p.clone(); + } + if let NodeKind::Text(t) = &mut n.kind { + t.runs.iter_mut().for_each(|r| r.style.fill = p.clone()); + } + } + }; + paint(&mut d, &Paint::solid(white)); + assert_eq!(overprints(&d, json!({})).1, 1, "paper white fills and characters knock out"); + paint(&mut d, &Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 }); + assert_eq!(overprints(&d, json!({})).1, 3, "a white spot ink overprints, characters too"); +} + #[test] fn pdf_a_overprint_mode_is_0() { let r = export(&overprinting(RED), json!({"standard": "pdfA2b", "compression": {"compressText": false}})); diff --git a/crates/pdf/src/tests/print.rs b/crates/pdf/src/tests/print.rs index bee9e61bad..958bef9e03 100644 --- a/crates/pdf/src/tests/print.rs +++ b/crates/pdf/src/tests/print.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use serde_json::json; -use vectorcraft_color::{Color, Freeform, FreeformPoint, Gradient, GradientKind, GradientPaint, GradientStop, Paint, Swatch}; +use vectorcraft_color::{BlendMode, Color, Freeform, FreeformPoint, Gradient, GradientKind, GradientPaint, GradientStop, Paint, Swatch}; use vectorcraft_doc::{Appearance, Artboard, Document, LayerColor, Node, NodeKind}; use vectorcraft_geom::{Rect, shapes}; use vectorcraft_testkit::raster::render_region; @@ -903,6 +903,47 @@ fn overprinting_near_blacks_linked_to_a_missing_swatch_keep_the_cyan_on_postscri assert_eq!(drawn(true, 3), (3, 1, 1), "PostScript Black plate: every black, not the faint fill"); } +#[test] +fn a_white_spot_ink_keeps_overprinting_on_plates_and_in_simulated_composites() { + // With Discard White Overprint on (the default), a paper white square over cyan knocks the + // cyan out; one in a white spot ink overprints: it puts no cyan down, so the cyan plate draws + // nothing for it, and Simulate composites it with Darken. + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + let square = |paint: Paint| { + let mut n = + Node::path(vectorcraft_doc::NodeId(0), shapes::rectangle(Rect::new(10.0, 15.0, 30.0, 35.0)), Appearance::basic(paint, Paint::None, 0.0)); + if let Some(f) = n.appearance.fill_mut() { + f.overprint = true; + } + let mut d = over_cyan(vec![n]); + d.swatches.push(Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true }); + d + }; + let (paper, spot) = (square(Paint::solid(white)), square(Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 })); + assert!(paper.setup.discard_white_overprint); + let cyan_fills = |d: &Document, output: serde_json::Value| { + let opts = PrintOptions { settings: settings(json!({"output": output})), ..Default::default() }; + let p = plan(d, &opts).unwrap(); + let mut count = 0; + p.plates[0].walk(|n| count += usize::from(n.appearance.fill().is_some_and(|f| !f.paint.is_none()))); + count + }; + let seps = json!({"mode": "separations"}); + assert_eq!((cyan_fills(&paper, seps.clone()), cyan_fills(&spot, seps)), (2, 1), "paper white knocks out; the spot white leaves the cyan"); + // The white ink printed as process inks is paper white. + let converted = json!({"mode": "separations", "inks": [{"name": "Opaque White", "convertToProcess": true}]}); + assert_eq!(cyan_fills(&spot, converted), 2, "a converted spot white knocks out"); + assert_eq!(cyan_fills(&spot, json!({"mode": "separations", "spotsToProcess": true})), 2, "so does one with every spot converted"); + let blends = |d: &Document| { + let opts = PrintOptions { settings: settings(json!({"advanced": {"overprints": "simulate"}})), ..Default::default() }; + let p = plan(d, &opts).unwrap(); + let mut out = vec![]; + p.doc.walk(|n| out.extend(n.appearance.fill().filter(|f| f.paint.color() == Some(white)).map(|f| f.blend))); + out + }; + assert_eq!((blends(&paper), blends(&spot)), (vec![BlendMode::Normal], vec![BlendMode::Darken])); +} + #[test] fn an_overprinting_fill_keeps_its_faint_ink_on_pdf_plates() { // 0.4% cyan beside 100% K, set to overprint: a PDF plate draws it with Darken, a PostScript diff --git a/crates/render/src/proof.rs b/crates/render/src/proof.rs index dd7d28eb23..09c9e1189d 100644 --- a/crates/render/src/proof.rs +++ b/crates/render/src/proof.rs @@ -34,8 +34,8 @@ pub use vectorcraft_color::cms::{Intent, ProofSetup, ProofTarget}; use vectorcraft_color::{Color, Paint, Swatch, SwatchGroup}; pub use vectorcraft_doc::inks::{Inks, Link, Plate, inks, map_document_colors, map_node_colors, plates, spot_color}; use vectorcraft_doc::inks::{StopPlates, map_node_inks, stop_inks}; -use vectorcraft_doc::overprint::darken_overprints; -use vectorcraft_doc::{AppearanceItem, Document, ImageBlob, Node, NodeId, Shared}; +use vectorcraft_doc::overprint::{DiscardWhite, darken_overprints}; +use vectorcraft_doc::{AppearanceItem, Document, ImageBlob, Node, NodeId, NodeKind, Shared}; use vello_cpu::Pixmap; use vello_cpu::color::PremulRgba8; @@ -391,6 +391,8 @@ impl Fit { /// one of them while they are kept. pub(crate) struct Prepared { inputs: Inputs, + /// The swatches `inputs.discard_white` was read from, while Discard White Overprint is on. + spots: Option, layers: (Vec>, Vec>), art: (Vec>, Vec>), } @@ -398,10 +400,18 @@ pub(crate) struct Prepared { /// What [`prepare`] reads besides the art. #[derive(PartialEq)] struct Inputs { - discard_white: bool, + discard_white: DiscardWhite, plates: Option, } +/// The document's swatches and swatch groups, which name its spot inks ([`DiscardWhite`]): while +/// they are unchanged, the spot ink names are not read again. +#[derive(PartialEq)] +struct SpotSwatches { + swatches: Shared>, + groups: Shared>, +} + /// What the colors of Separations Preview's plates are made from ([`plate_color`]). struct Plates { /// The proof setup, with the visible plates. @@ -429,7 +439,7 @@ impl PartialEq for Plates { /// print it ([`plate_color`]). struct How<'a> { doc: &'a Document, - discard_white: bool, + discard_white: &'a DiscardWhite, /// Separations Preview: the color settings, the proof setup and the visible plates. plates: Option<(&'a Cms, &'a ProofSetup, &'a [String])>, } @@ -438,12 +448,33 @@ impl How<'_> { /// Whether [`Self::apply`] can change `n`: with Separations Preview any node, else a node with /// an overprinting fill or stroke. fn changes(&self, n: &Node) -> bool { - self.plates.is_some() || n.appearance.items.iter().any(|i| i.overprint()) + self.plates.is_some() || n.appearance.items.iter().any(|i| i.overprint()) || self.white_characters(n) } - /// Change the fills, strokes and other colors of node `a`, which holds no members. + /// Whether type `n` has an overprinting character fill or stroke that Discard White Overprint + /// knocks out ([`DiscardWhite::knocks_out`]). + fn white_characters(&self, n: &Node) -> bool { + let white = |r: &vectorcraft_doc::TextRun| { + (r.style.overprint_fill && self.discard_white.knocks_out(&r.style.fill)) + || (r.style.overprint_stroke && self.discard_white.knocks_out(&r.style.stroke)) + }; + matches!(&n.kind, NodeKind::Text(t) if t.runs.iter().any(white)) + } + + /// Change the fills, strokes and other colors of node `a`, which holds no members. Character + /// fills and strokes that Discard White Overprint knocks out stop overprinting, judged on + /// their own colors before Separations Preview maps them to the visible plates; the renderer + /// darkens the others. fn apply(&self, a: &mut Arc) { darken_overprints(a, self.discard_white); + if self.white_characters(a) + && let NodeKind::Text(t) = &mut Arc::make_mut(a).kind + { + for r in &mut t.runs { + r.style.overprint_fill &= !self.discard_white.knocks_out(&r.style.fill); + r.style.overprint_stroke &= !self.discard_white.knocks_out(&r.style.stroke); + } + } if let Some((c, proof, visible)) = self.plates { map_node_inks(Arc::make_mut(a), &mut |col, sw, plates| plate_color(self.doc, c, proof, visible, col, sw, plates)); } @@ -461,8 +492,10 @@ pub(crate) fn prepare<'a>(doc: &'a Document, opts: &RenderOptions, kept: &mut Op } let seps = opts.proof.as_ref().and_then(|p| p.separations.as_ref().map(|s| (p, s))); let c = cms::active(); + let spots = doc.setup.discard_white_overprint.then(|| SpotSwatches { swatches: doc.swatches.clone(), groups: doc.swatch_groups.clone() }); + let read = kept.as_ref().filter(|k| k.spots == spots).map(|k| k.inputs.discard_white.clone()); let inputs = Inputs { - discard_white: doc.setup.discard_white_overprint, + discard_white: read.unwrap_or_else(|| DiscardWhite::of(doc)), plates: seps.map(|(proof, _)| Plates { proof: proof.clone(), swatches: doc.swatches.clone(), @@ -473,7 +506,7 @@ pub(crate) fn prepare<'a>(doc: &'a Document, opts: &RenderOptions, kept: &mut Op }), }; let earlier = kept.take().filter(|k| k.inputs == inputs); - let how = How { doc, discard_white: inputs.discard_white, plates: seps.map(|(proof, visible)| (&*c, proof, visible.as_slice())) }; + let how = How { doc, discard_white: &inputs.discard_white, plates: seps.map(|(proof, visible)| (&*c, proof, visible.as_slice())) }; let none = (vec![], vec![]); let (layers, art) = earlier.as_ref().map_or((&none, &none), |k| (&k.layers, &k.art)); let made_layers = prepare_list(&doc.layers, &layers.0, &layers.1, &how); @@ -490,7 +523,7 @@ pub(crate) fn prepare<'a>(doc: &'a Document, opts: &RenderOptions, kept: &mut Op } Cow::Owned(d) }; - *kept = Some(Prepared { inputs, layers: (doc.layers.clone(), made_layers), art: (symbol_art, made_art) }); + *kept = Some(Prepared { inputs, spots, layers: (doc.layers.clone(), made_layers), art: (symbol_art, made_art) }); out } diff --git a/crates/render/src/tests/memory.rs b/crates/render/src/tests/memory.rs index 2cdc41df3c..1b734b4522 100644 --- a/crates/render/src/tests/memory.rs +++ b/crates/render/src/tests/memory.rs @@ -2205,6 +2205,74 @@ fn rasters_follow_the_view_options() { draws_as_new(&mut d, &isolated, &on_white, unchanged); } +/// Overprinting white characters over red in Overprint Preview: paper white knocks out while +/// Discard White Overprint is on and vanishes into the red when it is turned off; a white spot ink +/// overprints with it on. In Separations Preview paper white characters knock the plate out too. +#[test] +fn overprinting_white_characters_follow_discard_white_overprint() { + let _fonts = fonts_steady(); + use vectorcraft_doc::text::{CharStyle, TextObject}; + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + let typed = || { + let mut d = Document::new(200.0, 100.0); + d.swatches.push(vectorcraft_color::Swatch { name: "Opaque White".into(), paint: Paint::solid(white), global: true, spot: true }); + let red = + filled(&mut d, vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, 200.0, 100.0)), Paint::solid(Color::rgb(1.0, 0.0, 0.0)), vec![]); + let style = CharStyle { size: 50.0, fill: Paint::solid(white), overprint_fill: true, ..Default::default() }; + let text = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(vectorcraft_geom::Point::new(10.0, 70.0), "Hamburg", style)))); + with_art(d, vec![red, text]) + }; + let overprints = RenderOptions { overprint_preview: true, background: Some([255, 255, 255, 255]), ..Default::default() }; + draws_as_new(&mut typed(), &overprints, &overprints, |d| d.setup.discard_white_overprint = false); + draws_as_new(&mut typed(), &overprints, &overprints, |d| { + let text = d.layers[0].children().unwrap()[1].id; + if let Some(NodeKind::Text(t)) = d.node_mut(text).map(|n| &mut n.kind) { + t.runs.iter_mut().for_each(|r| r.style.fill = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 }); + } + }); + // Knocking out shows the white of the characters; overprinting leaves only the red. + let whites = |d: &Document, opts: &RenderOptions| { + Renderer::new().render(d, 200, 100, Affine::IDENTITY, opts).pixels.chunks(4).filter(|p| p[0] > 250 && p[1] > 250 && p[2] > 250).count() + }; + let mut d = typed(); + assert!(whites(&d, &overprints) > 0, "paper white knocks out"); + d.setup.discard_white_overprint = false; + assert_eq!(whites(&d, &overprints), 0, "with the option off it overprints"); + let mut d = typed(); + let text = d.layers[0].children().unwrap()[1].id; + if let Some(NodeKind::Text(t)) = d.node_mut(text).map(|n| &mut n.kind) { + t.runs.iter_mut().for_each(|r| r.style.fill = Paint::Solid { color: white, swatch: Some("Opaque White".into()), tint: 1.0 }); + } + assert_eq!(whites(&d, &overprints), 0, "a white spot ink overprints"); + // Separations Preview: paper white characters over cyan knock the Cyan plate out. + let mut d = Document::new(200.0, 100.0); + let cyan = + filled(&mut d, vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, 200.0, 100.0)), Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)), vec![]); + let style = CharStyle { size: 50.0, fill: Paint::solid(white), overprint_fill: true, ..Default::default() }; + let text = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(vectorcraft_geom::Point::new(10.0, 70.0), "Hamburg", style)))); + let mut d = with_art(d, vec![cyan, text]); + let seps = RenderOptions { background: Some([255, 255, 255, 255]), ..proof_views(&["Cyan"]).1 }; + assert!(whites(&d, &seps) > 0, "paper white knocks the Cyan plate out"); + d.setup.discard_white_overprint = false; + assert_eq!(whites(&d, &seps), 0, "with the option off the cyan shows through"); + // Magenta characters over cyan, with only the Cyan plate shown: they put none of it down, so + // the cyan shows through them, as if they were not there. + let magenta = |with_text: bool| { + let mut d = Document::new(200.0, 100.0); + let cyan = filled( + &mut d, + vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, 200.0, 100.0)), + Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)), + vec![], + ); + let style = CharStyle { size: 50.0, fill: Paint::solid(Color::cmyk(0.0, 1.0, 0.0, 0.0)), overprint_fill: true, ..Default::default() }; + let text = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(vectorcraft_geom::Point::new(10.0, 70.0), "Hamburg", style)))); + let d = with_art(d, if with_text { vec![cyan, text] } else { vec![cyan] }); + Renderer::new().render(&d, 200, 100, Affine::IDENTITY, &proof_views(&["Cyan"]).1).pixels + }; + assert!(magenta(true) == magenta(false), "the characters leave the cyan plate as it is"); +} + /// A document for the proof previews: a cyan square, a magenta circle over it whose black stroke /// overprints, a white square over the cyan one that overprints, a blurred rectangle in spot color /// `Spot`, and an instance of symbol `S`, a group holding a yellow square. @@ -2273,8 +2341,8 @@ fn proof_previews_keep_their_art_between_frames() { /// With Overprint Preview or Separations Preview on, a renderer draws what a new renderer draws /// after a change to the art or to what the previews read: an object recolored, Discard White -/// Overprint turned off, a symbol's art recolored (its instance shows the plates of the new art), -/// the spot color redefined, a spot color in a color group redefined, the Spot Colors option set +/// Overprint turned off, an overprinting white's swatch made a spot color, a symbol's art +/// recolored (its instance shows the plates of the new art), the spot color redefined, a spot color in a color group redefined, the Spot Colors option set /// to CMYK values, a plate hidden, Simulate Paper Color, another proof profile, and one preview /// after the other. #[test] @@ -2296,6 +2364,19 @@ fn proof_previews_draw_changes_as_a_new_renderer_does() { for opts in [&overprint, &separations] { draws_as_new(&mut proof_doc(), opts, opts, recolor_square); draws_as_new(&mut proof_doc(), opts, opts, |d| d.setup.discard_white_overprint = false); + // The overprinting white square's swatch becomes a spot color, a white ink. + let mut linked = proof_doc(); + let white = Color::cmyk(0.0, 0.0, 0.0, 0.0); + linked.swatches.push(vectorcraft_color::Swatch { name: "White".into(), paint: Paint::solid(white), global: true, spot: false }); + let square = linked.layers[0].children().unwrap()[2].id; + if let Some(f) = linked.node_mut(square).unwrap().appearance.fill_mut() { + f.paint = Paint::Solid { color: white, swatch: Some("White".into()), tint: 1.0 }; + } + draws_as_new(&mut linked, opts, opts, |d| { + if let Some(s) = d.swatch_mut("White") { + s.spot = true; + } + }); } draws_as_new(&mut proof_doc(), &separations, &separations, recolor_symbol); draws_as_new(&mut proof_doc(), &separations, &separations, |d| { diff --git a/docs/mcp.md b/docs/mcp.md index 3c577e0356..043693126b 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5083,7 +5083,16 @@ objects differ). Overprint Preview (`view.overprintPreview`) and Separations Pre it by darkening (the stronger ink of each plate wins, so a colour overprinting itself stays that colour). Older files that listed Overprint Black objects in the document get the flags on load. PDF export writes them with `advanced.overprint: "preserve"` (the default): each overprinting fill and stroke sets a graphics state with `/OP true /op true /OPM 1` (`/OPM 0` in PDF/A). With `discardWhiteOverprint` (`document.setup`, on by -default) white ones knock out instead; `"discard"` writes none. +default) paper white ones knock out instead; `"discard"` writes none. Paper white is solid white that is not a spot +white. Spot white objects keep overprinting +([white overprint](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/white-overprint.html), +[reference, White Overprint](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=650)). +These are VectorCraft's own rules: a spot white is a white linked to a solid spot swatch at a tint above 0% (an opaque +white ink, for example), so a 0% tint of a spot swatch is paper white, and so is a spot white that printed separations +convert to process inks. A spot white's fills, strokes and characters keep overprinting in PDF export, Overprint Preview, +Separations Preview and printed separations, its fills and strokes keep overprinting in composite print with Overprints +set to Simulate, and Print Ink Fixes' `removeWhiteOverprint` leaves it overprinting. EPS export does not apply +`discardWhiteOverprint`. ```json {"name":"run_command","arguments":{"command":"object.setOverprint","params":{"ids":[12],"stroke":true}}} @@ -15398,7 +15407,7 @@ document's inks for print, as one undo step: | `scope` | `selection`, `document` (the selection, or the document while nothing is selected) | What it fixes; `ids` stand for the selection | | `inkLimit` | total ink % 1…400, 0 off (off) | CMYK colours (solid, gradient stops, gradient meshes) with more ink than this are scaled down to it; colours of spot swatches and Registration stay | | `excludePureBlack` | bool (true) | Black-only CMYK and grey colours keep their ink | -| `removeWhiteOverprint` | bool (false) | White fills and strokes, and characters', stop overprinting | +| `removeWhiteOverprint` | bool (false) | White fills and strokes, and characters', stop overprinting; a white linked to a spot swatch at a tint above 0% is an ink and keeps overprinting | | `overprintBlack` | black % 1…100, 0 off (off) | Black-only and grey fills and strokes this dark or darker overprint, as `edit.colors.overprintBlack` sets it (not spot-linked or rich blacks) | | `textOnly` | bool (false) | Overprint Black on type only | | `fill`, `stroke` | bool (true) | Which paints the fixes reach | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3da663c191..13dcea8089 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2388,6 +2388,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The Print dialog's Document Ink Options list shows an icon before each spot ink's name, and a click on it prints that one ink as process inks (on the Cyan, Magenta, Yellow and Black plates, with no plate of its own) or as a spot ink again, as [the help page](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) describes for single spot colors. Other spot inks keep their plates, and spot gradient stops and DCS images' spot plates follow each ink's choice (`print.setup {settings: {output: {inks: [{name, convertToProcess: true}]}}}`, kept with the document and in print presets; `print.preview` lists every ink as `documentInks`). These are VectorCraft's own rules: Convert All Spot Colors to Process converts every spot ink and dims the icons while keeping each ink's own choice, a converted ink's Print, Frequency and Angle are dimmed and kept, and process inks and Registration have no icon. Evidence: `print::one_spot_ink_converts_to_process_and_the_others_keep_their_plates`, `print::converting_every_spot_ink_overrides_and_keeps_each_inks_own_choice`, `print::a_spot_gradient_stop_prints_its_process_plates`, `cmykimages::a_dcs_image_converts_only_the_spot_ink_chosen`, `tests::print::a_spot_ink_converted_to_process_is_saved_and_listed_without_a_plate`, `dialogs::tests_print::a_spot_inks_icon_converts_it_to_process_and_back`. Print scores and hours are unchanged. - On a PostScript plate, an overprinting gradient that puts the plate's ink down in some places and none in others leaves the ink below where it puts none: the stretches between stops of paper white and the padding past an end that is painted paper white (with the end stop's color at Level 2 and the color of the stretch next to it in a Level 3 smooth shading, which differ when two stops share the end's offset) are clipped out of a linear, radial or diamond gradient, the wedges of paper white out of a conic one, and the cells whose 8-bit samples carry none of the plate's ink out of a freeform one (masked at Level 3, clipped at Level 2). This holds for fills, strokes and characters, and on spot plates. Where the gradient puts ink down, its amount replaces the ink below as before. A stop or point with up to half a percent of another ink in a color that counts as black puts none down, as a solid fill of that color does. PDF plates are unchanged. These are VectorCraft's own rules. Evidence: `print::tests::an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscript_plate`, `print::tests::an_overprinting_gradient_with_a_hard_stop_at_an_end_keeps_the_ink_below_on_a_postscript_plate`, `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` and `print::tests::an_overprinting_freeform_gradient_leaves_out_the_cells_its_samples_write_without_ink_on_a_postscript_plate` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. - The Print dialog's Output section has Overprint Black under Convert All Spot Colors to Process, off by default and available with Separations ([Print color separations](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) lists it among the separation options): black art then leaves the inks under it on the other plates (`print.setup {settings: {output: {overprintBlack: true}}}`, kept with the document and in print presets). Solid 100% K or 100% gray fills, strokes and characters (to within half a percent, as Edit › Edit Colors › Overprint Black counts them), and gradients whose every stop (every color point of a freeform gradient) is, overprint; rich, RGB, Lab, spot-linked and lighter blacks are not marked, paints already set to overprint keep that setting, and only the printed copy is marked. These limits are VectorCraft's own rules. Characters set to overprint now also leave the inks below them on printed PDF plates, a type object's own fill in a PDF is drawn with its blending mode, and Edit › Edit Colors › Overprint Black counts a gradient with a stop linked to a spot swatch as a spot black, as it counts a solid one, and a freeform gradient by the color points it draws from. On a plate, an overprinting paint that puts none of that plate's ink down is drawn as nothing; on PostScript plates so is up to half a percent of another ink in a color that counts as black, and any other faint ink stays on the plate. A black linked to a swatch the document lacks separates from its own values, so on PostScript plates it counts as an unlinked black (VectorCraft's own rule). Evidence: `print::overprint_black_keeps_the_inks_under_solid_black_on_separations`, `print::overprint_black_keeps_the_cyan_under_near_and_freeform_blacks_on_postscript_plates`, `print::overprint_black_keeps_the_cyan_under_a_near_black_linked_to_a_missing_swatch_on_postscript_plates`, `print::overprinting_near_blacks_linked_to_a_missing_swatch_keep_the_cyan_on_postscript_plates`, `print::overprinting_paints_keep_their_faint_ink_on_postscript_plates`, `print::overprinting_type_leaves_the_inks_below_on_separations`, `print::a_type_objects_own_black_fill_overprints_on_separations`, `tests::print::overprint_black_is_saved_with_the_setup_and_in_presets`, `overprint::tests::a_gradient_with_a_spot_linked_stop_is_black_only_with_spot`, `overprint::tests::a_freeform_gradient_is_black_when_every_point_is`. Print scores and hours are unchanged. + - With Discard White Overprint on, spot white objects keep overprinting and only paper white knocks out ([white overprint](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/white-overprint.html), [reference, White Overprint](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=650)). These are VectorCraft's own rules: a spot white is a white linked to a solid spot swatch at a tint above 0% (an opaque white ink, for example), so a 0% tint of a spot swatch is paper white, and so is a spot white that printed separations convert to process inks. A spot white's fills, strokes and characters keep overprinting in PDF export, Overprint Preview, Separations Preview and printed separations, its fills and strokes keep overprinting in composite print with Overprints set to Simulate, and Print Ink Fixes' Remove White Overprint leaves it overprinting. Overprint Preview and Separations Preview now also show overprinting paper white characters knocking out while the option is on, as PDF export writes them. EPS export keeps every overprint, as before. Evidence: `overprint::tests::a_white_spot_ink_overprints_under_discard_white`, `tests::layers::a_white_spot_ink_keeps_overprinting_under_discard_white_overprint` and `tests::print::a_white_spot_ink_keeps_overprinting_on_plates_and_in_simulated_composites` (`vectorcraft-pdf`), `cmd::addons::color::print_fixes::tests::a_white_spot_ink_keeps_its_overprint`, `tests::docsetup::discard_white_overprint_keeps_white_overprints_in_overprint_preview`, `tests::memory::proof_previews_draw_changes_as_a_new_renderer_does`, `tests::memory::overprinting_white_characters_follow_discard_white_overprint`. Print scores and hours are unchanged. - The Print dialog's General section (and the print preset editor) has a link button after Scale W and H, as the Custom scale has one on [the help page](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/print-documents-in-illustrator.html), where turning it off scales the width and height apart. While it is on, typing either percentage sets the other, and turning it on sets H to W. It is on for new settings, dimmed with the fields unless Scaling is Custom or a tiling choice, toggled with a click, Space or Enter, and named with its on or off state for screen readers. W and H take 1–1000% in the fields. The link is kept with the document's print settings and in print presets (`print.setup {settings: {scale: {linked}}}`); settings saved without it read it as off, so they print as before. Its default, the tiling choices and the agent rules are VectorCraft's own. Evidence: `print::the_scale_link_is_on_for_new_settings_and_off_for_a_saved_scale_without_it`, `tests::print::the_scale_link_keeps_width_and_height_equal`, `tests::print::a_scale_saved_without_the_link_keeps_its_width_and_height`, `dialogs::tests_print::the_scale_link_keeps_scale_width_and_height_equal`, `dialogs::tests_print::a_print_preset_keeps_the_scale_link`. Print scores and hours are unchanged. - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root ``. The title is File Info's alone (`DocMetadata::title`): the document's name stays the file's name with its extension, a file that gives no title leaves File Info with that name, and exports (PDF, SVG, PNG, EPS, `.ai`) and native saves carry it; changing the title in File Info sets the document's name as before (#3626). - PDF export and PDF-compatible `.ai` and `.ait` saves write the document's File Info created date as the file's creation date, or the time of writing when the document has none, and the time of writing as its modification date; the page information mark still prints the time of writing (`crates/engine/src/tests/fileinfo.rs`, `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/marks.rs`). @@ -2501,7 +2502,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The undo histories of all the open documents together keep their steps within a quarter of the installed memory on the same systems (at least 64 MiB, and at most a quarter of the address space in a 32-bit build), within 1 GiB where the installed memory can't be read, and within 256 MiB in the web build; past that budget the oldest steps of any open document are dropped first, but each document keeps its last eight undo steps and its next eight redo steps. Closing a document frees its share for the others. With `--deep`, each memory row of `vectorcraft-cli perf` also gives the peak so far: the peak working set on Windows and the peak resident memory (`VmHWM`) on Linux. A new last row gives the memory after the SVG export and the save → open → save at the end of the run. The renderer composes the two ink planes of a CMYK document that shows transparency into screen colors on up to as many threads as it rasterizes with, instead of on one. At 2880 × 1800 on 8 threads, a page of 300 shapes at 20% to 90% opacity takes 30 ms a frame instead of 55 ms, and 50,000 paths with one at 99% opacity take 258 ms instead of 361 ms (`vectorcraft-cli bench`), with the same pixels. - With Overprint Preview or Separations Preview on, the renderer keeps the art it prepared for the preview from one frame to the next. It prepares again the objects that changed, and all of the art when Discard White Overprint changes or, with Separations Preview, when the plates shown, the proof setup, the swatches, the Spot Colors option or the color settings change or a profile is loaded. It draws the other objects from the art, geometry and stroke outlines it kept for them. + With Overprint Preview or Separations Preview on, the renderer keeps the art it prepared for the preview from one frame to the next. It prepares again the objects that changed, and all of the art when Discard White Overprint changes, when a swatch becomes or stops being a spot color while it is on, or, with Separations Preview, when the plates shown, the proof setup, the swatches, the Spot Colors option or the color settings change or a profile is loaded. It draws the other objects from the art, geometry and stroke outlines it kept for them. Pathfinder › Merge and the `pathfinder.merge` group effect find the faces of every fill in a few contour passes over the arrangement, as Trim and Crop do, instead of one pass for each distinct fill. The output paths and their order are the same. With 8,000 squares that do not touch, each with its own fill, Merge takes 72 to 107 ms instead of 17 to 32 s (release build). The Pathfinder panel, Offset Path, Clean Up, Divide Objects Below, Make and Release Blend, Envelope Distort's Make and Release, Repeat (Radial, Grid, Mirror and Release), Vector Halftone, New and Redefine Symbol, Delete Symbol, erasing with the Symbol Sprayer, Rasterize, Convert to Artboards, Flatten Transparency, Clear Guides, Shape Builder, Live Paint, Release Image Trace, Make and Release Opacity Mask, Delete with direct-selected anchor points, Remove Anchor Points, Cut Path, and the Shaper, Knife, Eraser, Path Eraser, Line Cut, Rectangle Cut, Mirror & Cut and Blob Brush tools add and remove objects in one pass over each layer or group they change, and Outline Stroke and Expand write each new object in the place of the object it replaces (#1429). Cut Path at Selected Anchor Points (`path.cutAtAnchors`) selects the cut ends with one selection call, which skips paths already selected through a hash set, instead of adding each cut path in turn and searching the paths already added. The selection is the same, every field (`selecting_cut_ends_matches_adding_them_one_by_one`). With the 8 middle anchors of each of 5,000 open paths of 10 anchors selected, building the selection of 40,000 cut ends takes 9.7 ms instead of 232 ms of CPU time, and with 2,000 paths 3.2 ms instead of 39 ms; at 500 paths both take 3 ms or less (medians of 7 runs, `cargo run --release -p vectorcraft-engine --example cut_path_select_bench`). Scores and hours unchanged.