.ai save: the editing copy draws the artboards' background colors

The PDF pages of a .ai draw each artboard's background color (Include
Artboard Fill, on by default), but the editing copy of the art left it
out, so the two differed and the file reopened from its PDF part. The
editing copy now takes the same option.
This commit is contained in:
dotCooCoo
2026-10-31 21:09:39 -07:00
parent 2ca27de40b
commit b949038a2b
2 changed files with 15 additions and 1 deletions
+3 -1
View File
@@ -648,11 +648,13 @@ pub(super) fn encode_ai(cmd: &str, f: &Format, doc: &Document, p: &Value) -> Res
resolved = d;
(&resolved, w)
};
// With the artboards' background colors, as the pages draw them.
let art = super::export::with_artboard_fills(art, &params, 0..art.artboards.len()).map_err(|e| bad(cmd, e))?;
let o = vectorcraft_eps::AiEditingOptions {
title: doc.title.clone(),
created: doc.metadata.created.or_else(vectorcraft_doc::metadata::output_time),
};
let (data, lost) = vectorcraft_eps::ai_private_data(art, &o).map_err(|e| bad(cmd, e))?;
let (data, lost) = vectorcraft_eps::ai_private_data(&art, &o).map_err(|e| bad(cmd, e))?;
// Placed files that weren't found are written as their previews here too.
resolved_warnings.extend(lost);
carries_editing.set(true);
@@ -97,6 +97,18 @@ fn pdf_and_svg_show_the_color_and_their_editing_data_keeps_it_as_the_artboards()
assert_eq!(back.layers.len(), doc.layers.len(), "no art made of it");
}
#[test]
fn the_ai_editing_copy_for_other_apps_draws_the_color_as_the_pages_do() {
let mut s = session();
let opts = LoadOptions { native: false, ..Default::default() };
for (more, fill) in [(json!({}), true), (json!({"includeArtboardFill": false}), false)] {
let l = load::load_with("a.ai", &file(&mut s, with(json!({"format": "ai"}), &more)), &opts).unwrap();
assert!(l.editing_data && !l.restored, "{more}: {:?}", l.warnings);
let names: Vec<String> = l.doc.layers.iter().filter_map(|l| l.name.clone()).collect();
assert_eq!(names.iter().any(|n| n == "Artboard Fill"), fill, "{more}: {names:?}");
}
}
#[test]
fn eps_and_postscript_print_draw_the_color() {
let mut s = session();