diff --git a/crates/engine/src/tests/linked_stops.rs b/crates/engine/src/tests/linked_stops.rs index f3c44535a..354f072de 100644 --- a/crates/engine/src/tests/linked_stops.rs +++ b/crates/engine/src/tests/linked_stops.rs @@ -321,3 +321,19 @@ fn spot_gradients_drawn_as_images_warn() { assert!(pdf.contains("/Subtype/Image") && !pdf.contains("/Separation"), "a process Perceptual gradient"); assert!(!spot_warning(&warnings), "{warnings:?}"); } + +#[test] +fn freeform_gradients_without_points_warn_about_spot_stops() { + let (mut s, id) = setup(); + run(&mut s, "paint.editGradient", with(ink_to_white(100.0), json!({"kind": "freeform"}))); + // A freeform field with no points of its own: the colors come from the stops, the first + // linked to the spot swatch. + let mut g = gradient(&s, id); + g.freeform = Some(vectorcraft_color::Freeform::default()); + g.gradient.stops[0].swatch = Some("Ink".into()); + let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + d.node_mut(id).unwrap().appearance.set_fill(Paint::Gradient(Box::new(g))); + let (pdf, warnings) = pdf_of(&s); + assert!(pdf.contains("/Subtype/Image"), "an image"); + assert!(warnings.iter().any(|w| w.contains("spot colors in gradients exported as images")), "{warnings:?}"); +} diff --git a/crates/pdf/src/export/paint.rs b/crates/pdf/src/export/paint.rs index e8dfd4a07..379ebbd50 100644 --- a/crates/pdf/src/export/paint.rs +++ b/crates/pdf/src/export/paint.rs @@ -431,7 +431,7 @@ impl Exporter<'_> { /// in process colors, so the spot inks have no plate of their own. fn warn_spot_image(&mut self, g: &vectorcraft_color::GradientPaint) { let doc = self.doc; - let from_stops = g.gradient.kind != GradientKind::Freeform || g.freeform.is_none(); + let from_stops = g.gradient.kind != GradientKind::Freeform || !g.has_freeform_points(); if from_stops && g.gradient.stops.iter().any(|s| s.swatch.as_deref().is_some_and(|n| doc.swatch(n).is_some_and(|w| w.spot))) { self.warn( "spot colors in gradients exported as images (freeform or dithered gradients, and Perceptual ones with RGB or Lab stops or too many stops) are written in process colors",