From 295644fc9671a1c2c71d5a8a953e9059d111324d Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:30:40 -0500 Subject: [PATCH 1/2] EPS/.ai editing data: an empty variable library gives no note A file can keep an empty variable library: its variableSets, variableSet and sampleDataSets nodes named, with no values and no node types. The reader found no variable set in it and counted the library as skipped, so the import said the library couldn't be read. A library whose nodes hold no value or type has nothing to list: it now gives no note. A library with any value or type that can't be read keeps the note. --- crates/eps/src/import/ai/read/document.rs | 19 +++++++++++++++++ crates/eps/src/import/ai/tests.rs | 25 +++++++++++++++++++++++ docs/file-format-parity.md | 3 ++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index 65d949f0f4..6dc621cc6b 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -1627,6 +1627,20 @@ impl LibraryWalk { } /// The library of the `variableSets` element `sets` (see [`variable_library`]). +/// Whether an XML node in `o` or the dictionaries it holds has a value or a type +/// (`xmlnode-nodevalue`, `xmlnode-nodetype`). `seen` counts the dictionaries looked at; past +/// [`MAX_LIBRARY_NODES`] of them, or deeper than [`MAX_DEPTH`], the library is taken to hold some. +fn holds_values(o: &Obj, seen: &mut usize, depth: usize) -> bool { + *seen = seen.saturating_add(1); + if *seen > MAX_LIBRARY_NODES || depth > MAX_DEPTH { + return true; + } + if o.ty == "XMLNode" && (o.get("xmlnode-nodevalue").is_some() || o.get("xmlnode-nodetype").is_some()) { + return true; + } + o.items().any(|c| holds_values(c, seen, depth + 1)) +} + fn read_variable_sets(sets: &Obj) -> VariableRead { let mut walk = LibraryWalk::default(); let mut vars = Variables::default(); @@ -1645,5 +1659,10 @@ fn read_variable_sets(sets: &Obj) -> VariableRead { if walk.nodes > MAX_LIBRARY_NODES { return VariableRead { variables: Variables::default(), bindings: vec![], bindings_skipped: 0, skipped: 1, present: true }; } + if vars == Variables::default() && walk.bindings.is_empty() && !holds_values(sets, &mut 0, 0) { + // The empty library a file can keep: nodes with names and nothing else (no value, no + // type). There is nothing in it to list, so nothing was left out. + walk.skipped = 0; + } VariableRead { variables: vars, bindings: walk.bindings, bindings_skipped: walk.bindings_skipped, skipped: walk.skipped, present: true } } diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 36a93a690d..8786a2d5eb 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -2353,6 +2353,31 @@ fn ai_variable_library_edge_cases() { assert_eq!(notes, ["the file's variable library couldn't be read: the Variables panel doesn't list it"]); } +/// The empty library a file can keep, its nodes named and nothing else (no value, no type, empty +/// attributes), has nothing to list: it comes in without a note. A node that has a value or a type +/// isn't empty, so the same skeleton with a value still gets the note. +#[test] +fn an_empty_variable_library_gives_no_note() { + // A node with a name and nothing else: its children, then its attributes, as `%_` lines. + fn bare(name: &str, attributes: &[&str], children: &[String]) -> String { + let close = |n: &str, key: &str| format!("{}%_; {key},\n", n.strip_suffix("%_;\n").unwrap_or(n)); + let attributes: String = attributes.iter().map(|a| close(&bare(a, &[], &[]), &format!("({a}) "))).collect(); + let children: String = children.iter().map(|c| close(c, "")).collect(); + format!( + "%_/XMLNode :\n%_/Dictionary :\n{attributes}%_; (xmlnode-attributes) ,\n%_/Array :\n{children}%_; (xmlnode-children) ,\n%_({name}) /String (xmlnode-nodename) ,\n%_;\n" + ) + } + let data_sets = bare("v:sampleDataSets", &["xmlns:v", "xmlns"], &[]); + let skeleton = bare("variableSets", &[], &[bare("variableSet", &["varSetName"], std::slice::from_ref(&data_sets))]); + let (vars, notes) = read_library(&skeleton); + assert_eq!(vars, vectorcraft_doc::Variables::default()); + assert!(notes.is_empty(), "{notes:?}"); + // A node with a value isn't empty. + let valued = data_sets.replace("(xmlnode-nodename) ,\n", "(xmlnode-nodename) ,\n%_(x) /String (xmlnode-nodevalue) ,\n"); + let (_, notes) = read_library(&bare("variableSets", &[], &[bare("variableSet", &[], &[valued])])); + assert_eq!(notes, ["the file's variable library couldn't be read: the Variables panel doesn't list it"]); +} + /// When the layers can't be read, or reading stops before the library, [`variables`] still reads /// it, for the file read from its PDF part. #[test] diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index f60d46f622..66449897f4 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (EPS and `.ai` editing data: an empty variable library gives no note; EPS and `.ai` editing data: a transparency set inside a clipping group stays after its `Q`; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -212,6 +212,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | EPS and `.ai` editing data: an empty variable library (its XML nodes named and nothing else: no values, no types) no longer gives the note that the library couldn't be read. With nothing in it to list, nothing was left out; two users' Illustrator EPS files (used locally, not committed) open without the note. A library with any value or type that can't be read keeps the note. Test `import::ai::tests::an_empty_variable_library_gives_no_note` (crate `vectorcraft-eps`); scores unchanged | | 2026-11-06 | minor | EPS and `.ai` editing data: `Q` restores the painting state but not the transparency (`Xy`), which the writer only sets when the next object's differs from the last one written. A Screen glow followed by a clipping group set back to Normal no longer leaves the type after the group in Screen: two users' Illustrator 26.5 and 30 EPS posters (used locally, not committed) now show their gold heading and crescent, and both open from their layers (2.5% and 2.7% from the page before, under the limit after). Scores and estimates unchanged. | | 2026-11-06 | minor | EPS and `.ai` editing data: a blend whose spine was never edited, written with its keys and no spine part, comes in as a live blend along the straight lines between its keys' centres (in its record's order) instead of as its drawn steps. Checked on six users' Illustrator EPS files (used locally, not committed): every blend in four of them now comes in live, their renders unchanged; two still have blends the reader can't match to their drawn steps. Scores and estimates unchanged. | | 2026-11-06 | minor | EPS and `.ai` editing data: the art styles are found before the art is read, so objects in symbols defined ahead of `%AI9_BeginArtStyles` (as Illustrator 24 writes it) come in as themselves with their style instead of their drawn look. Checked on two users' EPS files (used locally, not committed): one's Symbols panel gains live Feather and Round Corners, its drawn-look count drops from 5 to 2, and both render unchanged; own-fixture test in `import::ai::tests`; scores and hours unchanged | From 91c0e030c7e0b7e8ff2624b594300b1f02cb0103 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Sun, 8 Nov 2026 03:47:10 -0500 Subject: [PATCH 2/2] EPS/.ai editing data: test an empty variable library's value and type cases and its caps The valued case now differs from the empty skeleton only by its value, a type alone keeps the note too, and an empty library past the node or depth cap is taken to hold values. The library's doc comment is back above read_variable_sets. --- crates/eps/src/import/ai/read/document.rs | 26 ++++++++++++++++++++++- crates/eps/src/import/ai/tests.rs | 16 +++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index 6dc621cc6b..d2a7c995a8 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -1626,7 +1626,6 @@ impl LibraryWalk { } } -/// The library of the `variableSets` element `sets` (see [`variable_library`]). /// Whether an XML node in `o` or the dictionaries it holds has a value or a type /// (`xmlnode-nodevalue`, `xmlnode-nodetype`). `seen` counts the dictionaries looked at; past /// [`MAX_LIBRARY_NODES`] of them, or deeper than [`MAX_DEPTH`], the library is taken to hold some. @@ -1641,6 +1640,7 @@ fn holds_values(o: &Obj, seen: &mut usize, depth: usize) -> bool { o.items().any(|c| holds_values(c, seen, depth + 1)) } +/// The library of the `variableSets` element `sets` (see [`variable_library`]). fn read_variable_sets(sets: &Obj) -> VariableRead { let mut walk = LibraryWalk::default(); let mut vars = Variables::default(); @@ -1666,3 +1666,27 @@ fn read_variable_sets(sets: &Obj) -> VariableRead { } VariableRead { variables: vars, bindings: walk.bindings, bindings_skipped: walk.bindings_skipped, skipped: walk.skipped, present: true } } + +#[cfg(test)] +mod tests { + use super::*; + use std::rc::Rc; + + /// An XML node holding `child` (when given) and nothing else: no value, no type. + fn node(child: Option) -> Obj { + let children = Obj { ty: "Array".into(), content: child.map(|c| V::Obj(Rc::new(c))).into_iter().collect(), ..Obj::default() }; + Obj { ty: "XMLNode".into(), entries: vec![(Some("xmlnode-children".into()), vec![V::Obj(Rc::new(children))])], ..Obj::default() } + } + + /// An empty library is taken to hold values past the caps on what is looked at: nested deeper + /// than [`MAX_DEPTH`], or once [`MAX_LIBRARY_NODES`] dictionaries have been looked at. + #[test] + fn an_empty_library_past_the_caps_is_taken_to_hold_values() { + let shallow = node(Some(node(None))); + assert!(!holds_values(&shallow, &mut 0, 0)); + let deep = (0..MAX_DEPTH).fold(node(None), |inner, _| node(Some(inner))); + assert!(holds_values(&deep, &mut 0, 0)); + let mut seen = MAX_LIBRARY_NODES; + assert!(holds_values(&shallow, &mut seen, 0)); + } +} diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 8786a2d5eb..b021924818 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -2355,7 +2355,7 @@ fn ai_variable_library_edge_cases() { /// The empty library a file can keep, its nodes named and nothing else (no value, no type, empty /// attributes), has nothing to list: it comes in without a note. A node that has a value or a type -/// isn't empty, so the same skeleton with a value still gets the note. +/// isn't empty, so the same skeleton with a value, or with a type, still gets the note. #[test] fn an_empty_variable_library_gives_no_note() { // A node with a name and nothing else: its children, then its attributes, as `%_` lines. @@ -2372,10 +2372,16 @@ fn an_empty_variable_library_gives_no_note() { let (vars, notes) = read_library(&skeleton); assert_eq!(vars, vectorcraft_doc::Variables::default()); assert!(notes.is_empty(), "{notes:?}"); - // A node with a value isn't empty. - let valued = data_sets.replace("(xmlnode-nodename) ,\n", "(xmlnode-nodename) ,\n%_(x) /String (xmlnode-nodevalue) ,\n"); - let (_, notes) = read_library(&bare("variableSets", &[], &[bare("variableSet", &[], &[valued])])); - assert_eq!(notes, ["the file's variable library couldn't be read: the Variables panel doesn't list it"]); + let unread = ["the file's variable library couldn't be read: the Variables panel doesn't list it"]; + // The same skeleton but for one entry of the data sets node: a value, then a type. + let with = |entry: &str| { + let data_sets = data_sets.replace("(xmlnode-nodename) ,\n", &format!("(xmlnode-nodename) ,\n{entry}")); + bare("variableSets", &[], &[bare("variableSet", &["varSetName"], &[data_sets])]) + }; + for entry in ["%_(x) /String (xmlnode-nodevalue) ,\n", "%_1 /Int (xmlnode-nodetype) ,\n"] { + let (_, notes) = read_library(&with(entry)); + assert_eq!(notes, unread, "{entry}"); + } } /// When the layers can't be read, or reading stops before the library, [`variables`] still reads