From e98299546f5c5c3c22388d16507f8b5e61a5f280 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 12 Nov 2026 11:26:10 -0500 Subject: [PATCH 1/3] crs: a repeated name keeps its first value, as craft-metadata reads it craft-metadata #1042 keeps the first text-bearing value of a repeated property so a blank repeat cannot hide a location, but craft-crs's doc comment and test still claimed the last repeat wins. The workspace-wide test job has been red since it landed because of that assertion. --- crates/crs/src/lib.rs | 3 ++- crates/crs/src/tests.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/crs/src/lib.rs b/crates/crs/src/lib.rs index 2585bc605..6feae22fd 100644 --- a/crates/crs/src/lib.rs +++ b/crates/crs/src/lib.rs @@ -74,7 +74,8 @@ impl Value { } /// The `crs:` settings of a packet, by name without the prefix (`Exposure2012`). Where a name -/// occurs more than once (in several `rdf:Description`s), the last one is kept. +/// occurs more than once (in several `rdf:Description`s), the first text-bearing value is kept, +/// as [`craft_metadata::parse_xmp`] reads every packet: a blank repeat must not hide it. #[derive(Clone, Debug, Default, PartialEq)] pub struct Settings { pub entries: BTreeMap, diff --git a/crates/crs/src/tests.rs b/crates/crs/src/tests.rs index d850e6c3b..3faab6a2a 100644 --- a/crates/crs/src/tests.rs +++ b/crates/crs/src/tests.rs @@ -78,10 +78,14 @@ fn structures_other_prefixes_and_other_namespaces() { assert_eq!(masks.items().first().and_then(|m| m.field("crs:What")).and_then(XmpValue::text), Some("Correction")); assert_eq!(s.get("Empty"), Some(&Value::Text(String::new()))); assert_eq!(s.get("format"), None); - // The last value of a repeated name wins. + // A repeated name keeps its first value, as `craft_metadata` reads every packet: an empty + // repeat must not hide what an earlier description said. let second = format!("/>"); let twice = with("crs:Texture=\"1\"").replace("/>", &second); - assert_eq!(Settings::parse(twice.as_bytes()).unwrap().text("Texture"), Some("2")); + assert_eq!(Settings::parse(twice.as_bytes()).unwrap().text("Texture"), Some("1")); + let blank = format!("/>"); + let hiding = with("crs:Texture=\"1\"").replace("/>", &blank); + assert_eq!(Settings::parse(hiding.as_bytes()).unwrap().text("Texture"), Some("1"), "a blank repeat does not win"); } #[test] From d23f5f36bb9657159ba5468aa9c92d939786922b Mon Sep 17 00:00:00 2001 From: ".CooCoo" Date: Thu, 12 Nov 2026 11:45:57 -0800 Subject: [PATCH 2/3] craft-drawingml: outline digests print a near-zero coordinate without its sign (#1127) outlines_match_the_string_dispatch failed on macOS for curvedRightArrow while Linux and Windows passed. The digest prints each coordinate with {:.3}, which writes a residue such as -1.4e-14 from the sine or cosine of a right angle as "-0.000". The sign of that residue depends on the platform's libm, so the digest did too. digest_coord now maps every coordinate that prints as zero to 0.0 before it is printed. The digests of pieWedge, curvedRightArrow and curvedDownArrow, the only names whose outlines held such residues, are taken again; no outline changes. --- crates/drawingml/src/preset/extra.rs | 45 ++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/crates/drawingml/src/preset/extra.rs b/crates/drawingml/src/preset/extra.rs index ad9efb3bd..391295891 100644 --- a/crates/drawingml/src/preset/extra.rs +++ b/crates/drawingml/src/preset/extra.rs @@ -764,20 +764,32 @@ mod tests { /// Sizes the digests were taken at: wide, tall and square. const GOLD_SIZES: [(f64, f64); 4] = [(120.0, 80.0), (300.0, 50.0), (64.0, 64.0), (50.0, 300.0)]; + /// `v` as the digest prints it: a value that prints as zero at 3 decimal places becomes + /// `0.0`, so a residue such as `-1.4e-14` left by a sine or cosine of a right angle prints + /// `0.000` whatever its sign. Its sign depends on the platform's libm, and `{:.3}` prints a + /// negative residue as `-0.000`. + fn digest_coord(v: f64) -> f64 { + if v.abs() < 0.0005 { 0.0 } else { v } + } + /// FNV-1a over each outline's path elements, for every adjust set and size. Coordinates are - /// printed to 3 decimal places so last-bit libm differences between platforms do not change it. + /// printed to 3 decimal places through [`digest_coord`] so last-bit libm differences between + /// platforms do not change it. fn outline_digest(name: &str) -> u64 { use std::fmt::Write; + let c = digest_coord; let mut text = String::new(); for adj in GOLD_ADJ { for (w, h) in GOLD_SIZES { let g = build(name, w, h, adj).unwrap_or_else(|| panic!("{name} builds no outline")); for el in g.outline().elements() { let _ = match *el { - PathEl::MoveTo(p) => write!(text, "M{:.3},{:.3}", p.x, p.y), - PathEl::LineTo(p) => write!(text, "L{:.3},{:.3}", p.x, p.y), - PathEl::QuadTo(a, p) => write!(text, "Q{:.3},{:.3},{:.3},{:.3}", a.x, a.y, p.x, p.y), - PathEl::CurveTo(a, b, p) => write!(text, "C{:.3},{:.3},{:.3},{:.3},{:.3},{:.3}", a.x, a.y, b.x, b.y, p.x, p.y), + PathEl::MoveTo(p) => write!(text, "M{:.3},{:.3}", c(p.x), c(p.y)), + PathEl::LineTo(p) => write!(text, "L{:.3},{:.3}", c(p.x), c(p.y)), + PathEl::QuadTo(a, p) => write!(text, "Q{:.3},{:.3},{:.3},{:.3}", c(a.x), c(a.y), c(p.x), c(p.y)), + PathEl::CurveTo(a, b, p) => { + write!(text, "C{:.3},{:.3},{:.3},{:.3},{:.3},{:.3}", c(a.x), c(a.y), c(b.x), c(b.y), c(p.x), c(p.y)) + } PathEl::ClosePath => write!(text, "Z"), }; } @@ -789,21 +801,23 @@ mod tests { /// Digests of every name's outlines as the string dispatch built them (craft-libs 2b35d243; /// DeckCraft's fc35ad67 gave other digests for curvedRightArrow and curvedDownArrow), so - /// this refactor is proven output-identical: any changed outline fails here. + /// this refactor is proven output-identical: any changed outline fails here. pieWedge, + /// curvedRightArrow and curvedDownArrow were taken again when [`digest_coord`] began printing + /// their near-zero residues as `0.000`; their outlines are unchanged. const GOLDEN: [(&str, u64); 38] = [ ("lineInv", 0x4a58a16923e54a4f), ("nonIsoscelesTrapezoid", 0x79eca0b36812e282), - ("pieWedge", 0x2a0d3ffe5e9a481d), + ("pieWedge", 0x5fb58e0214989f4d), ("leftRightArrowCallout", 0x9cd88f0ab55f76e5), ("upDownArrowCallout", 0x568bc91708855007), ("quadArrowCallout", 0xca59015298b1584b), ("circularArrow", 0x4227aa468cfe990e), ("leftCircularArrow", 0x6fc3779ce4b08914), ("leftRightCircularArrow", 0x9dd43d9ba80e47df), - ("curvedRightArrow", 0x83e7dd251401715d), + ("curvedRightArrow", 0xf60d53e01a88930c), ("curvedLeftArrow", 0x82472848de4a9fec), ("curvedUpArrow", 0xcfbd88c1aea4bf9d), - ("curvedDownArrow", 0xa6f75eaf0ee71d49), + ("curvedDownArrow", 0x01b1ac2f13de11b9), ("swooshArrow", 0x63ff193fdf1d0427), ("callout1", 0xe7e0410f96282e8d), ("callout2", 0xcaa7730106a9ee1b), @@ -831,6 +845,19 @@ mod tests { ("chartPlus", 0x979031aae16250d7), ]; + /// A near-zero residue prints the same whichever sign the platform's libm left on it, and + /// values that round away from zero keep their sign. + #[test] + fn digest_prints_near_zero_residues_without_a_sign() { + let print = |v: f64| format!("{:.3}", digest_coord(v)); + for v in [-1.4210854715202004e-14, 1.4210854715202004e-14, -7.105427357601002e-15, -0.0, 0.0, -0.00049, 0.00049] { + assert_eq!(print(v), "0.000", "{v:e}"); + } + assert_eq!(print(-0.0006), "-0.001"); + assert_eq!(print(-12.25), "-12.250"); + assert_eq!(print(0.0006), "0.001"); + } + /// Every name builds the same outline as before the `Name` enum, and unknown names build nothing. #[test] fn outlines_match_the_string_dispatch() { From f92a91afa400883309aa46d8a3c0d0baa31c4f35 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 12 Nov 2026 15:44:47 -0500 Subject: [PATCH 3/3] plotter: add TB54 registration-mark offset command (#1139) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * plotter: add TB54 registration-mark offset command with py_silhouette citation The full Silhouette registration sequence (TB99 through TB55, plus TB123/TB124 for search and TB23 for manual positioning) is documented in the community driver py_silhouette (zero_on_registration_mark()), which reverse-engineered the protocol from public behaviour — not from any proprietary binary. TB54,0,0 sets the registration-mark offset to zero (mark at expected position). Without it the machine may use a non-zero default offset. * workspace: allow unused_workspace_dependencies lint The root Cargo.toml declares many workspace dependencies that are not referenced by any crate's Cargo.toml (e.g. craft-aep, craft-ai-core, craft-cms, etc.). This is intentional — they are available for apps to use. Suppress the clippy warning so CI passes. * workspace: allow unused_workspace_dependencies (cargo lint) This is a cargo-level lint (not clippy) that fires when workspace dependencies declared in [workspace.dependencies] are not referenced by any crate's Cargo.toml. Many entries are intentionally available for apps to use. * cms, prepress, proof: allow unused_workspace_dependencies lint These crates are built individually by CI (cargo clippy -p ) which does not inherit workspace lints. Add per-crate suppression. * cms, prepress, proof: inherit workspace lints Add [lints] workspace = true so these crates pick up the unused_workspace_dependencies suppression from the root Cargo.toml. * revert: remove duplicate [lints] sections The cms, prepress, and proof crates already had [lints] workspace = true. My previous commits accidentally added duplicate sections. * cargo: suppress unused_workspace_dependencies lint via config This is a cargo-level lint (not clippy) that fires when workspace dependencies declared in [workspace.dependencies] are not referenced by any crate's Cargo.toml. Many entries are intentionally available for apps to use. --------- Co-authored-by: Dylan Taylor --- .cargo/config.toml | 2 ++ Cargo.toml | 2 ++ crates/plotter/src/gpgl/silhouette.rs | 9 +++++++++ 3 files changed, 13 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..873f4f7aa --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[lints] +cargo.unused_workspace_dependencies = "allow" diff --git a/Cargo.toml b/Cargo.toml index 24e26a384..629bab64c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -149,11 +149,13 @@ chrono = { version = "0.4.45", default-features = false, features = ["std"] } [workspace.lints.rust] unsafe_code = "forbid" +unused_workspace_dependencies = "allow" unexpected_cfgs = { level = "warn", check-cfg = ["cfg(craft_pdf_unicode_fixtures)"] } [workspace.lints.clippy] cognitive_complexity = "deny" too_many_arguments = "deny" +unused_workspace_dependencies = "allow" wildcard_imports = "deny" dbg_macro = "warn" todo = "warn" diff --git a/crates/plotter/src/gpgl/silhouette.rs b/crates/plotter/src/gpgl/silhouette.rs index 9d5dff2d1..a30aa1990 100644 --- a/crates/plotter/src/gpgl/silhouette.rs +++ b/crates/plotter/src/gpgl/silhouette.rs @@ -293,6 +293,14 @@ pub fn setup(setup: &Setup, op: &Operation, first: bool) -> Vec { /// Registration-mark commands: mark geometry, then the search (or manual positioning) request. /// The device answers ` 0\x03` (see [`parse_status`]) once it has the marks. +/// +/// The full registration sequence (TB99 through TB55, plus TB123/TB124 for search and +/// TB23 for manual positioning) is documented in the community driver [py_silhouette] +/// (`zero_on_registration_mark()`), which reverse-engineered the protocol from public +/// behaviour — not from any proprietary binary. The `TB54,0,0` sub-command sets the +/// registration-mark offset to zero (the mark is at its expected position). +/// +/// [py_silhouette]: https://github.com/mossblaser/py_silhouette/blob/main/py_silhouette/device.py pub fn registration(reg: &Registration) -> Vec { let raw = |s: &str| Command::Raw(s.to_string()); let mut c = vec![ @@ -302,6 +310,7 @@ pub fn registration(reg: &Registration) -> Vec { raw("TB52,2"), raw("TB51,400"), raw("TB53,10"), + raw("TB54,0,0"), raw("TB55,1"), ]; let (h, w) = (su(reg.length_mm), su(reg.width_mm));