diff --git a/crates/eps/src/print/tests.rs b/crates/eps/src/print/tests.rs index d3685ad5ab..8d2f81851c 100644 --- a/crates/eps/src/print/tests.rs +++ b/crates/eps/src/print/tests.rs @@ -156,12 +156,14 @@ fn plate_of(d: &Document, ink: &str, level: Level) -> (Image, Image) { } /// Ink `ink`'s PostScript plate of `art` over a page of 100% `ink` (`under`), checked against the -/// plate of `art` alone: where `art` puts none of the ink down, the ink under it prints, and -/// where it puts ink down, its own amount prints. The pixels of the page where `art` alone puts -/// no ink, those of them where the ink under it does not print, and the pixels where `art` puts -/// ink down that do not print its amount. -fn keeps_the_ink_below(art: &[Node], under: &Paint, ink: &str, level: Level) -> (usize, usize, usize) { - let (alone, _) = plate_of(&over(None, art), ink, level); +/// plate of `art` alone (drawn from the print plan, or with `postscript` from its PostScript +/// plate): where `art` puts none of the ink down, the ink under it prints, and where it puts ink +/// down, its own amount prints. The pixels of the page where `art` alone puts no ink, those of +/// them where the ink under it does not print, and the pixels where `art` puts ink down that do +/// not print its amount. +fn keeps_the_ink_below(art: &[Node], under: &Paint, ink: &str, level: Level, postscript: bool) -> (usize, usize, usize) { + let (plan, own) = plate_of(&over(None, art), ink, level); + let alone = if postscript { own } else { plan }; let (_, printed) = plate_of(&over(Some(under.clone()), art), ink, level); // Pixels whose neighbors all have paper (or all have ink) on the plate of `art` alone: an // edge falls on either side of a pixel's center, and the edge of the inked part is lightest. @@ -232,13 +234,48 @@ fn an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscri assert_keeps_the_ink_below(&cases); } +#[test] +fn an_overprinting_gradient_with_a_hard_stop_at_an_end_keeps_the_ink_below_on_a_postscript_plate() { + // Two stops at an end, one with cyan and one without: Level 2's bands pad with the end stop, + // Level 3's shading with the stretch next to it, so each level is checked against its own + // plate of the gradient alone. + let (inked, none) = (Color::cmyk(0.6, 0.3, 0.0, 0.0), Color::cmyk(0.0, 0.3, 0.0, 0.0)); + let ends = [ + ("none then cyan at 0", [(0.0, none), (0.0, inked), (1.0, inked)]), + ("cyan then none at 1", [(0.0, inked), (1.0, inked), (1.0, none)]), + ("cyan then none at 0", [(0.0, inked), (0.0, none), (1.0, none)]), + ("none then cyan at 1", [(0.0, none), (1.0, none), (1.0, inked)]), + ]; + let c = Point::new(100.0, 50.0); + let around = GradientGeom { start: c, end: c + Vec2::new(50.0, -10.0), aspect: 0.7, focal: None }; + let across = GradientGeom { start: Point::new(40.0, 40.0), end: Point::new(160.0, 60.0), aspect: 1.0, focal: None }; + let pad = GradientSpread::Pad; + let cyan = Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)); + let shapes = [(GradientKind::Linear, across, "linear"), (GradientKind::Radial, around, "radial"), (GradientKind::Diamond, around, "diamond")]; + let mut cases = vec![]; + for (name, stops) in &ends { + for (kind, geom, shape) in shapes { + let fill = gradient(kind, stops, geom, pad); + cases.push((format!("{shape}, {name}"), overprinting(fill, Paint::None), cyan.clone(), "Cyan")); + } + } + let cases: Vec<_> = cases.iter().map(|(name, art, under, ink)| (name.as_str(), art.clone(), under.clone(), *ink)).collect(); + assert_keeps_the_ink_below_of(&cases, true); +} + /// [`keeps_the_ink_below`] for each of `cases` (a name, the art, the paint under it and the ink /// of the plate) at Level 3 and Level 2, with every case that fails named. fn assert_keeps_the_ink_below(cases: &[(&str, Node, Paint, &str)]) { + assert_keeps_the_ink_below_of(cases, false); +} + +/// [`assert_keeps_the_ink_below`], checked against the PostScript plate of each case's art alone +/// with `postscript`. +fn assert_keeps_the_ink_below_of(cases: &[(&str, Node, Paint, &str)], postscript: bool) { let mut failed = vec![]; for (name, art, under, ink) in cases { for level in [Level::Three, Level::Two] { - let (paper, knocked_out, wrong) = keeps_the_ink_below(std::slice::from_ref(art), under, ink, level); + let (paper, knocked_out, wrong) = keeps_the_ink_below(std::slice::from_ref(art), under, ink, level, postscript); if knocked_out + wrong >= 100 { failed.push(format!("{name} at level {level:?}: {knocked_out} of {paper} knocked out, {wrong} of the others differ")); } diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index 9aae8bb98c..feee718176 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -1226,7 +1226,7 @@ impl<'a> Scene<'a> { } let space = &space; let smooth = self.o.level == Level::Three && !self.o.compatible_gradients; - let spans = if g.gradient.kind == GradientKind::Conic { None } else { self.inked_spans(space, &stops) }; + let spans = if g.gradient.kind == GradientKind::Conic { None } else { self.inked_spans(space, &stops, smooth) }; match g.gradient.kind { GradientKind::Conic => self.conic_steps(&geom, area, space, &stops, &g.gradient), GradientKind::Diamond => { @@ -1299,18 +1299,19 @@ impl<'a> Scene<'a> { /// Where an overprinting gradient with `stops` in `space` puts ink on a plate /// ([`Self::keep_below`]): the spans of its levels outside every stretch between two stops of - /// paper white and outside the padding past an end whose stop is paper white, in order, an - /// end padding with ink unbounded. `None` when the gradient puts ink everywhere or does not - /// overprint on a plate; empty when it puts none down. - fn inked_spans(&self, space: &GradientSpace, stops: &[(f64, Vec)]) -> Option> { + /// paper white and outside the padding past an end painted paper white, in order, an end + /// padding with ink unbounded. The padding takes the end stop's color when stepped and the + /// end stretch's color when `smooth` ([`Self::shading`]); the two differ when two stops share + /// the end's offset. `None` when the gradient puts ink everywhere or does not overprint on a + /// plate; empty when it puts none down. + fn inked_spans(&self, space: &GradientSpace, stops: &[(f64, Vec)], smooth: bool) -> Option> { if !self.keep_below { return None; } let stretches: Vec<_> = stops.windows(2).filter(|w| w[1].0 > w[0].0).collect(); let (first, last) = (stretches.first()?, stretches.last()?); - // The padding takes the end stop's color stepped and the end stretch's color smooth. - let before = stops.first().is_some_and(|s| space.paper(&s.1)) && space.paper(&first[0].1); - let after = stops.last().is_some_and(|s| space.paper(&s.1)) && space.paper(&last[1].1); + let (start, end) = if smooth { (&first[0].1, &last[1].1) } else { (&stops.first()?.1, &stops.last()?.1) }; + let (before, after) = (space.paper(start), space.paper(end)); let mut blank: Vec<(f64, f64)> = vec![]; let mut add = |a: f64, b: f64| match blank.last_mut() { Some(l) if l.1 >= a => l.1 = l.1.max(b), diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f3e39caba1..d4a4aa28b5 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2067,7 +2067,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Desktop print transport uses `craft-print` for CUPS and modern Windows. Sheet composition, copies, separations and colour management remain in VectorCraft. The Print dialog's Media list also carries the Japanese papers — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (250 × 353 and 176 × 250 mm, kept so settings and presets saved before them keep their paper), and はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm, 長形4号 90 × 225 mm, 角形2号 240 × 332 mm, 角形3号 216 × 277 mm and 四六判 127 × 188 mm; the JSON id or the dialog label names a paper, any case and spacing (`B5 (JIS)` or `b5jis`) (`crates/pdf/src/print/settings.rs`, `crates/pdf/src/tests/print.rs`). The print-preview and physical-device fidelity gaps remain, so print scores and hours are unchanged. - 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. - 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. 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::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. - - 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 stop of paper white are clipped out of a linear, radial or diamond gradient, the wedges of paper white out of a conic one, and the cells of paper white 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` and `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. + - 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 of paper white 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` and `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. - 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`).