VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Type tool icons: one family, the same T with a frame, wave, arrow or dotted box; the vertical Area and Path tools get their own
ham9zaha141372cd94a
diff --git a/ASSETS.md b/ASSETS.mdindex 3233c99d0..15bf448ec 100644--- a/ASSETS.md+++ b/ASSETS.md@@ -228,9 +228,12 @@ Generated-in-code art is original and has no file to list. This covers the defau| `assets/icons/dc-transform-panel.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-transparency.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-twirl.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |+| `assets/icons/dc-type.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-type-area.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-type-path.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-type-vertical.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |+| `assets/icons/dc-type-vertical-area.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |+| `assets/icons/dc-type-vertical-path.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-width-profile.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-width.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | || `assets/icons/dc-wrinkle.svg` | VectorCraft contributors | Original work, drawn for VectorCraft | MIT OR Apache-2.0 | |diff --git a/assets/icons/dc-touch-type.svg b/assets/icons/dc-touch-type.svgindex f5af072c9..24b305c87 100644--- a/assets/icons/dc-touch-type.svg+++ b/assets/icons/dc-touch-type.svg@@ -1 +1 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 5h9M10.5 5v11"/><rect x="14" y="12" width="7" height="8" stroke-dasharray="1.5 1.5"/></svg>+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5V4h10v1M8 4v10M6 14h4"/><rect x="14" y="12" width="7" height="9" stroke-dasharray="0.01 2.6"/><circle cx="21" cy="12" r="1.2" fill="currentColor"/></svg>diff --git a/assets/icons/dc-type-area.svg b/assets/icons/dc-type-area.svgindex f37960dae..31e53d2e0 100644--- a/assets/icons/dc-type-area.svg+++ b/assets/icons/dc-type-area.svg@@ -1 +1 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" stroke-dasharray="2 2"/><path d="M8 8h8M12 8v9"/></svg>+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5V4h10v1M8 4v10M6 14h4"/><rect x="14" y="12" width="7" height="9" rx="1"/><path d="M16.2 15h2.6M16.2 18h2.6"/></svg>diff --git a/assets/icons/dc-type-path.svg b/assets/icons/dc-type-path.svgindex 42584412c..6fc3fc0a6 100644--- a/assets/icons/dc-type-path.svg+++ b/assets/icons/dc-type-path.svg@@ -1 +1 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 19 C8 9 16 9 21 19"/><path d="M8 5h8M12 5v8"/></svg>+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5V4h10v1M10 4v9M8 13h4"/><path d="M3 19.5c2.5-3.5 5.5-4 8-2s5.5 1.5 10-2.5"/></svg>diff --git a/assets/icons/dc-type-vertical-area.svg b/assets/icons/dc-type-vertical-area.svgnew file mode 100644index 000000000..e5bd3c533--- /dev/null+++ b/assets/icons/dc-type-vertical-area.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5V4h10v1M8 4v10M6 14h4"/><rect x="14" y="12" width="7" height="9" rx="1"/><path d="M16.2 14.5v4M18.8 14.5v4"/></svg>diff --git a/assets/icons/dc-type-vertical-path.svg b/assets/icons/dc-type-vertical-path.svgnew file mode 100644index 000000000..66a30346a--- /dev/null+++ b/assets/icons/dc-type-vertical-path.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5V4h9v1M7.5 4v9M5.5 13h4"/><path d="M18 3v8M16 9l2 2 2-2"/><path d="M3 19.5c2.5-3.5 5.5-4 8-2s5.5 1.5 10-2.5"/></svg>diff --git a/assets/icons/dc-type-vertical.svg b/assets/icons/dc-type-vertical.svgindex d72855530..e7f157b44 100644--- a/assets/icons/dc-type-vertical.svg+++ b/assets/icons/dc-type-vertical.svg@@ -1 +1 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4h10M12 4v8"/><path d="M9 15h6M12 15v6"/></svg>+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5V4h10v1M8 4v10M6 14h4"/><path d="M18 9v12M15.5 18.5 18 21l2.5-2.5"/></svg>diff --git a/assets/icons/dc-type.svg b/assets/icons/dc-type.svgnew file mode 100644index 000000000..5ddf5a50e--- /dev/null+++ b/assets/icons/dc-type.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 6V4h14v2M12 4v16M9 20h6"/></svg>diff --git a/crates/tools/src/catalog.rs b/crates/tools/src/catalog.rsindex ac18d6beb..9bbd7cbdf 100644--- a/crates/tools/src/catalog.rs+++ b/crates/tools/src/catalog.rs@@ -37,8 +37,8 @@ pub const TOOL_GROUPS: &[&[ToolInfo]] = &[t("areaType", "Area Type Tool", None, "tool-type-area"),t("typeOnPath", "Type on a Path Tool", None, "tool-type-path"),t("verticalType", "Vertical Type Tool", None, "tool-type-vertical"),- t("verticalAreaType", "Vertical Area Type Tool", None, "tool-type-vertical"),- t("verticalTypeOnPath", "Vertical Type on a Path Tool", None, "tool-type-path"),+ t("verticalAreaType", "Vertical Area Type Tool", None, "tool-type-vertical-area"),+ t("verticalTypeOnPath", "Vertical Type on a Path Tool", None, "tool-type-vertical-path"),t("touchType", "Touch Type Tool", Some("Shift+T"), "tool-touch-type"),],&[diff --git a/crates/ui-egui/src/icon_data.rs b/crates/ui-egui/src/icon_data.rsindex 33ddde543..579df2187 100644--- a/crates/ui-egui/src/icon_data.rs+++ b/crates/ui-egui/src/icon_data.rs@@ -174,9 +174,12 @@ pub static ICONS: &[(&str, &[u8])] = &[("dc-transform-panel", include_bytes!("../../../assets/icons/dc-transform-panel.svg")),("dc-transparency", include_bytes!("../../../assets/icons/dc-transparency.svg")),("dc-twirl", include_bytes!("../../../assets/icons/dc-twirl.svg")),+ ("dc-type", include_bytes!("../../../assets/icons/dc-type.svg")),("dc-type-area", include_bytes!("../../../assets/icons/dc-type-area.svg")),("dc-type-path", include_bytes!("../../../assets/icons/dc-type-path.svg")),("dc-type-vertical", include_bytes!("../../../assets/icons/dc-type-vertical.svg")),+ ("dc-type-vertical-area", include_bytes!("../../../assets/icons/dc-type-vertical-area.svg")),+ ("dc-type-vertical-path", include_bytes!("../../../assets/icons/dc-type-vertical-path.svg")),("dc-width", include_bytes!("../../../assets/icons/dc-width.svg")),("dc-width-profile", include_bytes!("../../../assets/icons/dc-width-profile.svg")),("dc-wrinkle", include_bytes!("../../../assets/icons/dc-wrinkle.svg")),diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rsindex 8987cc64c..a3601af18 100644--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@ -29,10 +29,12 @@ pub fn tool_icon(name: &str) -> &'static str {"tool-pen-delete" => "pen-tool-delete","tool-anchor" => "dc-anchor","tool-curvature" => "spline",- "tool-type" => "type",+ "tool-type" => "dc-type","tool-type-area" => "dc-type-area","tool-type-path" => "dc-type-path","tool-type-vertical" => "dc-type-vertical",+ "tool-type-vertical-area" => "dc-type-vertical-area",+ "tool-type-vertical-path" => "dc-type-vertical-path","tool-touch-type" => "dc-touch-type","tool-line" => "dc-line","tool-arc" => "dc-arc",@@ -212,6 +214,20 @@ mod tests {assert_ne!(add, delete, "plus and minus differ");}+ /// The seven type tools each have an icon of their own, drawn for VectorCraft (the vertical+ /// Area and Path tools used to borrow the horizontal ones' icons).+ #[test]+ fn every_type_tool_has_its_own_icon_with_the_same_t() {+ let tools = ["type", "areaType", "typeOnPath", "verticalType", "verticalAreaType", "verticalTypeOnPath", "touchType"];+ let names: Vec<&str> = tools.iter().map(|id| tool_icon(vectorcraft_tools::catalog::tool_info(id).unwrap().icon)).collect();+ let unique: std::collections::BTreeSet<_> = names.iter().collect();+ assert_eq!(unique.len(), tools.len(), "{names:?}");+ for name in &names {+ assert!(name.starts_with("dc-"), "{name} is drawn for VectorCraft");+ assert!(exists(name), "{name}");+ }+ }+#[test]fn shared_catalog_preserves_fallback_and_tool_aliases() {let ImageSource::Bytes { uri, bytes } = source("missing-icon") else { panic!("expected SVG bytes") };