Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Colour: craft-cms fea1712; a document's CMYK profile name resolves through stand_in_for

aiongge31941afc08a
diff --git a/Cargo.lock b/Cargo.lock
index ceeef46f9..5f61a9793 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -811,7 +811,7 @@ dependencies = [
[[package]]
name = "craft-cms"
version = "0.1.0"
-source = "git+https://github.com/aiongg/craft-libs.git?rev=ace3622d427387cb197e7997ce116241ea290ed9#ace3622d427387cb197e7997ce116241ea290ed9"
+source = "git+https://github.com/aiongg/craft-libs.git?rev=fea1712934921c5718fbcf5fef8928d020354ad1#fea1712934921c5718fbcf5fef8928d020354ad1"
dependencies = [
"rayon",
]
diff --git a/Cargo.toml b/Cargo.toml
index 7a6e2d30d..16a9c8ee2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -73,7 +73,7 @@ indd = { git = "https://github.com/aiongg/indd-utils", branch = "main" }
craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d991bf6792f8ade99c51358bf3c1d902c8cd96b5" }
# ICC colour management: working spaces, transforms, black point compensation (craft-libs).
-craft-cms = { git = "https://github.com/aiongg/craft-libs.git", rev = "ace3622d427387cb197e7997ce116241ea290ed9" }
+craft-cms = { git = "https://github.com/aiongg/craft-libs.git", rev = "fea1712934921c5718fbcf5fef8928d020354ad1" }
# ui
# Shared frontend components; keep this dependency above the engine boundary.
diff --git a/crates/color/src/cms/mod.rs b/crates/color/src/cms/mod.rs
index 45445b1dc..d3d52af63 100644
--- a/crates/color/src/cms/mod.rs
+++ b/crates/color/src/cms/mod.rs
@@ -228,7 +228,7 @@ fn cmyk_space(name: &str) -> Result<CmykSpace, CmsError> {
Some(p) if p.kind == ProfileKind::Cmyk => Ok(CmykSpace::Icc(p)),
Some(_) => Err(CmsError::Unsupported(format!("{name} is not a CMYK profile"))),
// Names of the profiles the built-in stands in for (Coated FOGRA39 (ISO 12647-2:2004), ISO Coated v2 (ECI) …).
- None if craft_cms::Builtin::from_profile_name(name) == Some(craft_cms::Builtin::CoatedFogra39) => Ok(default_cmyk()),
+ None if craft_cms::Builtin::stand_in_for(name) == Some(craft_cms::Builtin::CoatedFogra39) => Ok(default_cmyk()),
None => Err(CmsError::UnknownProfile(name.into())),
},
}
diff --git a/crates/color/src/cms/tests.rs b/crates/color/src/cms/tests.rs
index 14fa68b75..76819efcb 100644
--- a/crates/color/src/cms/tests.rs
+++ b/crates/color/src/cms/tests.rs
@@ -67,6 +67,9 @@ fn saved_cmyk_names_still_load() {
// The names of the profiles the built-in stands in for show the same colours.
let adobe = Cms::new(&ColorSettings { cmyk: "Coated FOGRA39 (ISO 12647-2:2004)".into(), ..Default::default() }).unwrap();
assert_eq!(shown(&adobe, [0.0, 50.0, 100.0, 0.0]), shown(&cms(), [0.0, 50.0, 100.0, 0.0]));
+ // A related press condition with a different ink limit has no stand-in.
+ let iso300 = ColorSettings { cmyk: "ISO Coated v2 300% (ECI)".into(), ..Default::default() };
+ assert!(matches!(Cms::new(&iso300), Err(CmsError::UnknownProfile(_))));
// A name that isn't available falls back to the default, keeping the other settings.
let saved = ColorSettings { rgb: ADOBE_RGB.into(), cmyk: "Some Press (gone)".into(), bpc: false, ..Default::default() };
assert!(Cms::new(&saved).is_err());