diff --git a/Cargo.lock b/Cargo.lock index d11d18b3c5..d899b17bbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1256,7 +1256,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-automation", "craft-behavior", @@ -1298,7 +1298,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "crc32fast", "flate2", @@ -1319,7 +1319,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "rustix 1.1.6", ] @@ -1339,7 +1339,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1383,7 +1383,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-docpath", @@ -1401,7 +1401,7 @@ dependencies = [ [[package]] name = "craft-cdr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-codepage", "crc32fast", @@ -1411,7 +1411,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "egui", ] @@ -1419,7 +1419,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "md-5", "rayon", @@ -1428,12 +1428,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-cms", @@ -1453,7 +1453,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1469,7 +1469,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1479,7 +1479,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "rayon", ] @@ -1487,7 +1487,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1513,7 +1513,7 @@ dependencies = [ [[package]] name = "craft-doc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "blake3", "craft-ecproj-format", @@ -1529,7 +1529,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "serde", ] @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1556,7 +1556,7 @@ dependencies = [ [[package]] name = "craft-dwg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "acadrust", "craft-dxf", @@ -1566,7 +1566,7 @@ dependencies = [ [[package]] name = "craft-dxf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-codepage", "encoding_rs", @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-ecproj-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "serde", "serde_json", @@ -1588,12 +1588,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-atomic", "dirs", @@ -1603,7 +1603,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1637,7 +1637,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1646,7 +1646,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "cap-primitives", "craft-atomic", @@ -1669,12 +1669,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" [[package]] name = "craft-gif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "gif", ] @@ -1682,7 +1682,7 @@ dependencies = [ [[package]] name = "craft-gzip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "flate2", ] @@ -1690,7 +1690,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1703,7 +1703,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1733,7 +1733,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-dds", "craft-jpeg", @@ -1760,7 +1760,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "thiserror 2.0.21", ] @@ -1786,7 +1786,7 @@ dependencies = [ [[package]] name = "craft-jxl" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "brotli-decompressor 5.0.3", "jixel", @@ -1797,7 +1797,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-host", "craft-i18n", @@ -1812,7 +1812,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-i18n", @@ -1826,7 +1826,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -1844,7 +1844,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1856,7 +1856,7 @@ dependencies = [ [[package]] name = "craft-metafile" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "encoding_rs", "image", @@ -1867,7 +1867,7 @@ dependencies = [ [[package]] name = "craft-mime" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "chrono", "craft-codepage", @@ -1877,7 +1877,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "uds_windows", "winsafe", @@ -1886,7 +1886,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-keymap", @@ -1902,7 +1902,7 @@ dependencies = [ [[package]] name = "craft-pbr" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-texture", "thiserror 2.0.21", @@ -1911,7 +1911,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "flate2", "serde", @@ -1922,7 +1922,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "hayro-interpret", "hayro-syntax", @@ -1934,7 +1934,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "async-channel", "async-io", @@ -1968,7 +1968,7 @@ dependencies = [ [[package]] name = "craft-plotter" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "kurbo 0.13.1", "thiserror 2.0.21", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -2001,7 +2001,7 @@ dependencies = [ [[package]] name = "craft-proof" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "log", "miniz_oxide 0.9.1", @@ -2012,7 +2012,7 @@ dependencies = [ [[package]] name = "craft-ps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-eps", "flate2", @@ -2026,7 +2026,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "encoding_rs", "flate2", @@ -2037,7 +2037,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "dispatch2", "egui", @@ -2050,7 +2050,7 @@ dependencies = [ [[package]] name = "craft-raster3d" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "rayon", "thiserror 2.0.21", @@ -2059,7 +2059,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2078,7 +2078,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-atomic", "craft-host", @@ -2095,7 +2095,7 @@ dependencies = [ [[package]] name = "craft-stream-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "fax", "hayro-ccitt", @@ -2106,7 +2106,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2127,7 +2127,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2139,7 +2139,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2164,7 +2164,7 @@ dependencies = [ [[package]] name = "craft-texture" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "thiserror 2.0.21", ] @@ -2172,7 +2172,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2187,7 +2187,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-atomic", "craft-behavior", @@ -2202,7 +2202,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "serde", "thiserror 2.0.21", @@ -2221,7 +2221,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-keymap", @@ -2236,12 +2236,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2255,7 +2255,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "accesskit", "craft-behavior", @@ -2310,7 +2310,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2321,7 +2321,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -2339,7 +2339,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -2360,7 +2360,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -2381,7 +2381,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-behavior", "craft-host", @@ -2401,7 +2401,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "base64 0.22.1", "chrono", @@ -2433,7 +2433,7 @@ dependencies = [ [[package]] name = "craft-vectorcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "flate2", "serde", @@ -2444,7 +2444,7 @@ dependencies = [ [[package]] name = "craft-wayland" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "raw-window-handle", "wayland-backend", @@ -2454,7 +2454,7 @@ dependencies = [ [[package]] name = "craft-web-api" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "js-sys", "serde_json", @@ -2465,7 +2465,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "winsafe", ] @@ -2473,7 +2473,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "craft-appkit", "craft-atomic", @@ -2505,7 +2505,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "quick-xml 0.41.0", "serde", @@ -3864,7 +3864,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "brotli 8.0.4", "hayro-postscript", @@ -3873,7 +3873,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3891,7 +3891,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3909,12 +3909,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "flate2", "hayro-ccitt", @@ -4937,7 +4937,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "base64 0.22.1", "bumpalo", @@ -5094,7 +5094,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -7700,7 +7700,7 @@ dependencies = [ [[package]] name = "skrifa" version = "0.44.0" -source = "git+https://github.com/storytold/craft-libs?rev=138ce9929ea48d055c797f61c042a3c407427d97#138ce9929ea48d055c797f61c042a3c407427d97" +source = "git+https://github.com/storytold/craft-libs?rev=6b67abe4b3deead5a1437dc6987a85b35afd40f6#6b67abe4b3deead5a1437dc6987a85b35afd40f6" dependencies = [ "bytemuck", "read-fonts 0.41.0", diff --git a/Cargo.toml b/Cargo.toml index 2fd858dda3..9aef0a621b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,62 +10,62 @@ license = "MIT OR Apache-2.0" rust-version = "1.95" [workspace.dependencies] -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", default-features = false, features = ["interpret", "write"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6", default-features = false, features = ["interpret", "write"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # Language packs: the Craft apps' shared font store installs them (#4936). -craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON. -craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile. -craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", features = ["pcraft-pixels"] } +craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6", features = ["pcraft-pixels"] } # Native Affinity documents (craft-libs#914). -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778). -craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # SVG parsing, limits, SVGZ and writer (craft-libs#778). -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", features = ["tree"] } -craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6", features = ["tree"] } +craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # Digits typed in any script in numeric fields (`vectorcraft_doc::units`). -craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # EPS container, previews, ASCII85 and DSC comments (craft-libs#778). -craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # DXF tags, reader and writer (craft-libs#778, #926, #927). -craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # DWG to DXF bytes, in a child process on desktop builds (acadrust 0.6.6, MPL-2.0, unmodified). -craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # The DWG reader and writer craft-dwg uses, at the rev craft-libs pins (its Cargo.toml). Tests only: it writes the # R12, R13 and R14 DWG files that craft-dwg's writer, 2000 and later, does not. acadrust = { git = "https://github.com/storytold/acadrust.git", rev = "468b9d8e317755209020d5d3f2f1c8a76210c47f" } # WMF, EMF and EMF+ reader (craft-libs#778). -craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", default-features = false, features = ["read", "write"] } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6", default-features = false, features = ["read", "write"] } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # The metallic-roughness BRDF and environment light the 3D effects' Roughness and Metallic shade with. -craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-pbr = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # The CPU rasterizer that draws a 3D effect's Render Settings › Rendered image: depth-buffered triangles, shadow maps. -craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-raster3d = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names # the members it imports. -craft = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui # without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes. -craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # Nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # internal vectorcraft-geom = { path = "crates/geom" } vectorcraft-color = { path = "crates/color" } @@ -205,15 +205,15 @@ lto = "thin" codegen-units = 1 [patch.crates-io] -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -krilla = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } # skrifa 0.44 (epaint, glifo, usvg) with the automatic hinter's long blue-zone exit (craft-libs vendor/skrifa). -skrifa = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97" } +skrifa = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } emath = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } epaint = { git = "https://github.com/storytold/egui.git", rev = "399fc6e0ea65059e37de680f11ebbd177bf7d4ff" } diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 8b7d0e896c..d23793c802 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -28,7 +28,7 @@ egui_extras = { workspace = true } # `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback. eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] } # The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft. -craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "138ce9929ea48d055c797f61c042a3c407427d97", version = "0.1.0" } +craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "6b67abe4b3deead5a1437dc6987a85b35afd40f6", version = "0.1.0" } wasm-bindgen = "0.2" serde_json = { workspace = true } diff --git a/crates/cad/src/blocks_compat.rs b/crates/cad/src/blocks_compat.rs deleted file mode 100644 index bcc4860314..0000000000 --- a/crates/cad/src/blocks_compat.rs +++ /dev/null @@ -1,115 +0,0 @@ -//! Block definitions and INSERT entities for the DXF writer. -//! -//! Temporary: `craft_dxf::drawing` at the pinned craft-libs revision writes only the model and -//! paper space blocks. storytold/craft-libs#5381 adds `Block`, `Drawing::blocks` and -//! `Codes::insert`; once it merges and the pin moves past it, this module is removed and -//! `scene.rs` uses those instead. Until then [`write`] adds the user blocks to the file that -//! `Drawing::write` returns, with the same group codes #5381 writes. - -use craft_dxf::drawing::{Codes, Drawing, Handle, fixed}; - -/// A block definition: entities written once, which INSERT entities place ([`insert`]). Its base -/// point is the origin. -#[derive(Clone, Debug)] -pub struct Block { - pub name: String, - /// The handle of its BLOCK_RECORD (from R13), which owns its entities. - pub record: Handle, - /// The handles of its BLOCK and ENDBLK records. - pub begin: Handle, - pub end: Handle, - /// The entities' group codes, written with `record` as their owner. - pub entities: String, -} - -/// The start of an object: its type, and from R13 its handle, owner and first subclass. -fn object(c: &mut Codes, kind: &str, h: Handle, owner: Handle, subclass: &str) { - c.raw(0, kind); - if c.v.handles() { - c.handle(5, h); - c.handle(330, owner); - c.raw(100, subclass); - } -} - -/// An INSERT entity owned by `owner` on `layer` that places block `block` at the origin, unscaled -/// and unrotated. It has no color of its own (ByLayer). -pub fn insert(c: &mut Codes, h: Handle, owner: Handle, layer: &str, block: &str) { - object(c, "INSERT", h, owner, "AcDbEntity"); - c.str(8, layer); - if c.v.handles() { - c.raw(100, "AcDbBlockReference"); - } - c.str(2, block); - c.xyz(10, 0.0, 0.0); -} - -/// The whole file of `d` with `blocks` written after the model and paper space blocks. -pub fn write(d: Drawing, blocks: &[Block]) -> String { - let v = d.version; - let out = d.write(); - if blocks.is_empty() { - return out; - } - let mut defs = Codes::new(v); - for b in blocks { - object(&mut defs, "BLOCK", b.begin, b.record, "AcDbEntity"); - defs.raw(8, "0"); - if v.handles() { - defs.raw(100, "AcDbBlockBegin"); - } - defs.str(2, &b.name); - defs.int(70, 0); - defs.xyz(10, 0.0, 0.0); - defs.str(3, &b.name); - defs.raw(1, ""); - defs.append(&b.entities); - object(&mut defs, "ENDBLK", b.end, b.record, "AcDbEntity"); - defs.raw(8, "0"); - if v.handles() { - defs.raw(100, "AcDbBlockEnd"); - } - } - let defs = defs.into_string(); - if !v.handles() { - // R12 has no model and paper space blocks: its BLOCKS section holds the user blocks only. - let at = " 0\nSECTION\n 2\nENTITIES\n"; - return match out.find(at) { - Some(i) => format!("{} 0\nSECTION\n 2\nBLOCKS\n{defs} 0\nENDSEC\n{}", &out[..i], &out[i..]), - None => out, - }; - } - let mut records = Codes::new(v); - for b in blocks { - object(&mut records, "BLOCK_RECORD", b.record, fixed::BLOCK_RECORD_TABLE, "AcDbSymbolTableRecord"); - records.raw(100, "AcDbBlockTableRecord"); - records.str(2, &b.name); - if v.r2000() { - records.handle(340, Handle(0)); - records.int(70, 0); - records.int(280, 1); - records.int(281, 0); - } - } - let records = records.into_string(); - let (Some(table), Some(blocks_at)) = (out.find(" 0\nTABLE\n 2\nBLOCK_RECORD\n"), out.find(" 0\nSECTION\n 2\nBLOCKS\n")) else { - return out; - }; - let count = " 70\n2\n"; - let (Some(c), Some(t_end), Some(b_end)) = ( - out[table..].find(count).map(|i| table + i), - out[table..].find(" 0\nENDTAB\n").map(|i| table + i), - out[blocks_at..].find(" 0\nENDSEC\n").map(|i| blocks_at + i), - ) else { - return out; - }; - let mut s = String::with_capacity(out.len() + records.len() + defs.len()); - s.push_str(&out[..c]); - s.push_str(&format!(" 70\n{}\n", 2 + blocks.len())); - s.push_str(&out[c + count.len()..t_end]); - s.push_str(&records); - s.push_str(&out[t_end..b_end]); - s.push_str(&defs); - s.push_str(&out[b_end..]); - s -} diff --git a/crates/cad/src/import.rs b/crates/cad/src/import.rs index f4c4cf99c8..af90b84748 100644 --- a/crates/cad/src/import.rs +++ b/crates/cad/src/import.rs @@ -19,10 +19,10 @@ //! - `curve`: bulges, arcs, ellipses and NURBS as Bézier paths. //! - `hatch`: pattern hatches' lines and gradient hatches' fills. //! - `text`: text values to plain text. -//! - `acis`: a region's solid-modeler data as its outline. //! - `build`: items to the document. +//! +//! A region's solid-modeler data becomes its outline in `craft_dxf::acis`. -mod acis; mod build; mod curve; mod entity; diff --git a/crates/cad/src/import/acis.rs b/crates/cad/src/import/acis.rs deleted file mode 100644 index 581e168625..0000000000 --- a/crates/cad/src/import/acis.rs +++ /dev/null @@ -1,779 +0,0 @@ -//! The solid-modeler data of a REGION as a filled outline: each face's loops of edges, in world x -//! and y (drawing units). The data comes as text (DXF before 2013, ciphered or not) or binary -//! (DXF 2013 and later keep it in the ACDSDATA section). -//! -//! The model is a list of records pointing at each other: a body holds lumps, a lump shells, a -//! shell faces, a face loops, a loop a ring of coedges. Each coedge uses an edge (forward or -//! reversed), and each edge runs between two vertices along a line, an ellipse or a spline. A -//! curve of any other kind comes in as a straight line between its vertices. -//! -//! The REGION groups are in the DXF Reference -//! (); which -//! DXF versions hold text and which binary data is in . - -use std::collections::HashMap; - -use kurbo::{BezPath, ParamCurve, ParamCurveArclen, ParamCurveNearest, PathSeg}; -use vectorcraft_geom::{Affine, Point}; - -use super::curve; - -/// The most bytes of one region's data read. -pub(crate) const MAX_BYTES: usize = 16 << 20; -/// The most records one region's outline may visit: bodies, lumps, shells, faces and coedges -/// (a loop counts as one at least). -const MAX_VISITS: usize = 1_000_000; -/// The first bytes of binary data: ACIS's, or ASM's (DXF 2018 writes either). -const BINARY_MAGIC: [&[u8]; 2] = [b"ACIS BinaryFile", b"ASM BinaryFile4"]; -/// From this version on, every record starts with its attribute, a history number and one more -/// pointer; before it, with its attribute alone. -const LONG_HEADER_VERSION: u32 = 700; - -type P3 = [f64; 3]; -/// A B-spline: degree, knots, control points, weights (none: all 1). -type Spline = (usize, Vec, Vec, Option>); - -/// One value of a record. -#[derive(Clone, Debug, PartialEq)] -enum Tok { - Ptr(i64), - Num(f64), - Word(String), - /// `forward` (false) or `reversed` (true). - Sense(bool), - Open, - Close, -} - -/// A record: its type (`body`, `plane-surface`…) and its values after the ones every record -/// starts with. -#[derive(Debug)] -struct Rec { - kind: String, - toks: Vec, -} - -impl Rec { - /// The type `base` or one derived from it (`tedge-edge` is an edge). - fn is(&self, base: &str) -> bool { - self.kind == base || self.kind.strip_suffix(base).is_some_and(|k| k.ends_with('-')) - } - - /// The `n`th pointer (-1: none). - fn ptr(&self, n: usize) -> i64 { - self.toks.iter().filter_map(|t| if let Tok::Ptr(p) = t { Some(*p) } else { None }).nth(n).unwrap_or(-1) - } - - /// The sense right after the `n`th pointer: true when reversed (old files write 1). - fn sense_after(&self, n: usize) -> Option { - let mut ptrs = 0; - for t in &self.toks { - if ptrs > n { - return match t { - Tok::Sense(r) => Some(*r), - Tok::Num(v) if v.is_finite() => Some(*v != 0.0), - _ => None, - }; - } - if matches!(t, Tok::Ptr(_)) { - ptrs += 1; - } - } - None - } - - /// The numbers, in order. - fn nums(&self) -> Vec { - self.toks.iter().filter_map(|t| if let Tok::Num(v) = t { Some(*v) } else { None }).collect() - } -} - -/// The records of one body, and how pointers find them. -struct Model { - recs: Vec, - /// Record number by index, when the records carry their own. - at: HashMap, -} - -impl Model { - fn get(&self, p: i64) -> Option<&Rec> { - if p < 0 { - return None; - } - if self.at.is_empty() { self.recs.get(usize::try_from(p).ok()?) } else { self.recs.get(*self.at.get(&p)?) } - } - - /// The record `p` points at when it is of type `base`. - fn get_is(&self, p: i64, base: &str) -> Option<&Rec> { - self.get(p).filter(|r| r.is(base)) - } - - /// The records of type `base` from `first` along their `next` pointer (pointer `next`), each - /// once. Missing records, wrong types and cycles outside coedge rings set `broken`. - fn chain(&self, first: i64, base: &str, next: usize, broken: &mut bool) -> Vec<&Rec> { - let mut out = vec![]; - let mut seen = std::collections::HashSet::new(); - let mut p = first; - while p >= 0 { - if !seen.insert(p) { - *broken |= base != "coedge"; - break; - } - let Some(r) = self.get_is(p, base) else { - *broken = true; - break; - }; - out.push(r); - p = r.ptr(next); - } - out - } -} - -/// A region's outline: its faces' loops, closed; `approximated` when an edge of a curve type -/// this reader doesn't draw came in as a straight line; `broken` when a topology chain breaks -/// off or a loop's ring of coedges doesn't come back to its first; `ambiguous` when an edge's -/// endpoint lies on separate parts of its curve. -#[derive(Debug)] -pub(crate) struct Outline { - pub path: BezPath, - pub approximated: bool, - pub broken: bool, - pub ambiguous: bool, -} - -/// Text data, ciphered as DXF writes it or not. -pub(crate) fn from_text(text: &str) -> Option { - if text.len() > MAX_BYTES { - return None; - } - let plain; - let text = if text.trim_start().starts_with(|c: char| c.is_ascii_digit()) { - text - } else { - plain = decipher(text); - &plain - }; - outline(&sat_model(text)?) -} - -/// Binary data. -pub(crate) fn from_binary(bytes: &[u8]) -> Option { - if bytes.len() > MAX_BYTES { - return None; - } - outline(&sab_model(bytes)?) -} - -/// DXF's cipher of text data undone: each printable character is mapped back, and the space -/// written after a mapped `A` (a caret, which DXF reads as a control code) is dropped. -fn decipher(s: &str) -> String { - let mut out = String::with_capacity(s.len()); - let mut chars = s.chars().peekable(); - while let Some(c) = chars.next() { - out.push(match c { - ' ' | '\n' | '\r' | '\t' => c, - '@'..='_' => char::from(159 - c as u8), - c if c.is_ascii() && !c.is_ascii_control() => char::from(c as u8 ^ 0x5F), - c => c, - }); - if c == '^' && chars.peek() == Some(&' ') { - chars.next(); - } - } - out -} - -/// How many values every record starts with in data of `version`. -fn header_len(version: u32) -> usize { - if version >= LONG_HEADER_VERSION { 3 } else { 1 } -} - -/// A text value as a value. -fn sat_tok(w: &str) -> Tok { - match w { - "{" => Tok::Open, - "}" => Tok::Close, - "forward" | "forward_v" => Tok::Sense(false), - "reversed" | "reversed_v" => Tok::Sense(true), - _ => { - if let Some(p) = w.strip_prefix('$').and_then(|p| p.parse::().ok()) { - return Tok::Ptr(p); - } - match w.parse::() { - Ok(v) if v.is_finite() => Tok::Num(v), - _ => Tok::Word(w.to_string()), - } - } - } -} - -/// Does this line start a record (`[-] $ …`)? -fn starts_record(line: &str) -> bool { - let mut words = line.split_whitespace(); - let first = words.next().unwrap_or_default(); - let (kind, next) = if first.starts_with('-') && first[1..].parse::().is_ok() { - (words.next().unwrap_or_default(), words.next().unwrap_or_default()) - } else { - (first, words.next().unwrap_or_default()) - }; - kind.starts_with(|c: char| c.is_ascii_alphabetic()) && next.starts_with('$') -} - -/// Text data's records: a version line, product and tolerance lines, then records ending in `#`. -fn sat_model(text: &str) -> Option { - let version = text.split_whitespace().next()?.parse::().ok().filter(|v| v.is_finite() && *v >= 0.0)? as u32; - let skip = header_len(version); - let mut offset = text.find('\n')? + 1; - let start = loop { - let rest = text.get(offset..)?; - let line = rest.split('\n').next().unwrap_or_default(); - if starts_record(line) { - break offset; - } - offset += line.len() + 1; - }; - let body = text.get(start..)?; - let (mut recs, mut at) = (Vec::new(), HashMap::new()); - let mut cur: Vec = vec![]; - let (mut kind, mut index): (Option, Option) = (None, None); - let mut i = 0; - let b = body.as_bytes(); - while i < b.len() { - if b[i].is_ascii_whitespace() { - i += 1; - continue; - } - let end = b[i..].iter().position(u8::is_ascii_whitespace).map_or(b.len(), |n| i + n); - let word = body.get(i..end)?; - i = end; - // A counted string: `@`, a space, then n bytes. - if let Some(n) = word.strip_prefix('@').and_then(|n| n.parse::().ok()) { - let from = (i + 1).min(b.len()); - let to = from.checked_add(n)?.min(b.len()); - cur.push(Tok::Word(body.get(from..to)?.to_string())); - i = to; - continue; - } - let (word, ends) = match word.strip_suffix('#') { - Some(w) => (w, true), - None => (word, false), - }; - if !word.is_empty() { - match &kind { - None if index.is_none() && word.starts_with('-') && word[1..].parse::().is_ok() => { - index = word[1..].parse().ok(); - } - None => { - if word.starts_with("End-of-") || word.starts_with("Begin-of-") { - break; - } - kind = Some(word.to_string()); - } - Some(_) => cur.push(sat_tok(word)), - } - } - if ends { - let toks = cur.split_off(skip.min(cur.len())); - cur.clear(); - if let Some(n) = index.take() { - at.insert(n, recs.len()); - } - recs.push(Rec { kind: kind.take().unwrap_or_default(), toks }); - } - } - Some(Model { recs, at }) -} - -/// Reads binary data's little-endian values. -struct Bytes<'b> { - b: &'b [u8], - i: usize, -} - -impl Bytes<'_> { - fn take(&mut self, n: usize) -> Option<&[u8]> { - let s = self.b.get(self.i..self.i.checked_add(n)?)?; - self.i += n; - Some(s) - } - fn u8(&mut self) -> Option { - self.take(1).map(|s| s[0]) - } - fn i16(&mut self) -> Option { - self.take(2).map(|s| f64::from(i16::from_le_bytes([s[0], s[1]]))) - } - fn u16(&mut self) -> Option { - self.take(2).map(|s| usize::from(u16::from_le_bytes([s[0], s[1]]))) - } - fn i32(&mut self) -> Option { - self.take(4).map(|s| i32::from_le_bytes([s[0], s[1], s[2], s[3]])) - } - fn u32(&mut self) -> Option { - self.take(4).map(|s| u32::from_le_bytes([s[0], s[1], s[2], s[3]])) - } - fn f64(&mut self) -> Option { - let s = self.take(8)?; - Some(f64::from_le_bytes([s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]])) - } - fn text(&mut self, n: usize) -> Option { - self.take(n).map(|s| String::from_utf8_lossy(s).into_owned()) - } -} - -/// Binary data's records: the magic, four numbers (version first), product and tolerance values, -/// then records of tagged values, each type name made of its parts. -fn sab_model(b: &[u8]) -> Option { - let mut r = Bytes { b: BINARY_MAGIC.iter().find_map(|m| b.strip_prefix(*m))?, i: 0 }; - let version = r.u32()?; - r.take(12)?; - let skip = header_len(version); - let mut recs = vec![]; - let (mut parts, mut kind, mut cur): (Vec, Option, Vec) = (vec![], None, vec![]); - while r.i < r.b.len() { - let tag = r.u8()?; - let tok = match tag { - 0x02 => Tok::Num(f64::from(i8::from_le_bytes([r.u8()?]))), - 0x03 => Tok::Num(r.i16()?), - 0x04 | 0x15 => Tok::Num(f64::from(r.i32()?)), - 0x05 => Tok::Num(f64::from(f32::from_le_bytes(r.take(4)?.try_into().ok()?))), - 0x06 | 0x17 => Tok::Num(r.f64()?), - 0x07 => { - let n = usize::from(r.u8()?); - Tok::Word(r.text(n)?) - } - 0x08 => { - let n = r.u16()?; - Tok::Word(r.text(n)?) - } - 0x09 | 0x12 => { - let n = usize::try_from(r.u32()?).ok()?; - Tok::Word(r.text(n)?) - } - 0x0A => Tok::Sense(true), - 0x0B => Tok::Sense(false), - 0x0C => Tok::Ptr(i64::from(r.i32()?)), - 0x0D | 0x0E => { - let n = usize::from(r.u8()?); - let name = r.text(n)?; - if kind.is_some() { - Tok::Word(name) - } else { - parts.push(name); - if tag == 0x0D { - let k = parts.join("-"); - parts.clear(); - if k.starts_with("End-of-") || k.starts_with("Begin-of-") { - break; - } - kind = Some(k); - } - continue; - } - } - 0x0F => Tok::Open, - 0x10 => Tok::Close, - 0x11 => { - if let Some(k) = kind.take() { - let toks = cur.split_off(skip.min(cur.len())); - recs.push(Rec { kind: k, toks }); - } - cur.clear(); - continue; - } - 0x13 | 0x14 => { - for _ in 0..3 { - cur.push(Tok::Num(r.f64()?)); - } - continue; - } - 0x16 => { - for _ in 0..2 { - cur.push(Tok::Num(r.f64()?)); - } - continue; - } - _ => return None, - }; - // Values before the first record are the header's. - if kind.is_some() { - cur.push(tok); - } - } - Some(Model { recs, at: HashMap::new() }) -} - -/// A body's placement: `p · m · scale + t`. -#[derive(Clone, Copy)] -struct Xf { - m: [P3; 3], - scale: f64, - t: P3, -} - -impl Xf { - const IDENTITY: Xf = Xf { m: [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], scale: 1.0, t: [0.0; 3] }; - - /// A `transform` record's: nine matrix numbers row by row, the translation, the scale. - fn read(r: &Rec) -> Option { - let n: Vec = r.toks.iter().map_while(|t| if let Tok::Num(v) = t { Some(*v) } else { None }).collect(); - if n.iter().any(|v| !v.is_finite()) { - return None; - } - let v = |i: usize| n.get(i).copied(); - let row = |i: usize| Some([v(i)?, v(i + 1)?, v(i + 2)?]); - let scale = v(12)?; - Some(Xf { m: [row(0)?, row(3)?, row(6)?], t: row(9)?, scale }) - } - - fn vector(&self, p: P3) -> P3 { - let [a, b, c] = self.m; - std::array::from_fn(|i| (p[0] * a[i] + p[1] * b[i] + p[2] * c[i]) * self.scale) - } - - fn point(&self, p: P3) -> P3 { - let v = self.vector(p); - std::array::from_fn(|i| v[i] + self.t[i]) - } -} - -/// Seen from above: x and y. -fn flat(p: P3) -> Point { - Point::new(p[0], p[1]) -} - -fn sub(a: P3, b: P3) -> P3 { - [a[0] - b[0], a[1] - b[1], a[2] - b[2]] -} - -fn dot(a: P3, b: P3) -> f64 { - a[0] * b[0] + a[1] * b[1] + a[2] * b[2] -} - -fn cross(a: P3, b: P3) -> P3 { - [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]] -} - -fn p3(n: &[f64], i: usize) -> Option { - Some([*n.get(i)?, *n.get(i + 1)?, *n.get(i + 2)?]) -} - -/// Endpoints farther apart than rounding at their coordinate size allows. -fn endpoints_apart(a: Point, b: Point) -> bool { - a.distance(b) > 1e-6 * (1.0 + a.x.hypot(a.y).max(b.x.hypot(b.y))) -} - -/// Every face's loops of every body, as one path (filled even-odd). -fn outline(m: &Model) -> Option { - let mut o = Outline { path: BezPath::new(), approximated: false, broken: false, ambiguous: false }; - // Records visited at every level together: chains shared between records are walked again - // each time. - let mut visits = 0usize; - let mut spend = |n: usize| { - visits = visits.saturating_add(n.max(1)); - (visits <= MAX_VISITS).then_some(()) - }; - for body in m.recs.iter().filter(|r| r.is("body")) { - spend(1)?; - let xf = if body.ptr(2) == -1 { Xf::IDENTITY } else { Xf::read(m.get_is(body.ptr(2), "transform")?)? }; - for lump in m.chain(body.ptr(0), "lump", 0, &mut o.broken) { - spend(1)?; - for shell in m.chain(lump.ptr(1), "shell", 0, &mut o.broken) { - spend(1)?; - for face in m.chain(shell.ptr(2), "face", 0, &mut o.broken) { - spend(1)?; - for lp in m.chain(face.ptr(1), "loop", 0, &mut o.broken) { - let ring = m.chain(lp.ptr(1), "coedge", 0, &mut o.broken); - spend(ring.len())?; - let complete = ring.last().is_some_and(|c| c.ptr(0) == lp.ptr(1)); - o.broken |= !complete; - let mut bp = BezPath::new(); - for c in ring { - let edge = m.get_is(c.ptr(3), "edge")?; - let (seg, ambiguous) = edge_path(m, edge, c.sense_after(3)?, &xf, &mut o.approximated)?; - o.ambiguous |= ambiguous; - if let (Some(end), Some(start)) = - (bp.elements().last().and_then(|e| e.end_point()), seg.elements().first().and_then(|e| e.end_point())) - { - o.broken |= endpoints_apart(end, start); - } - super::entity::append(&mut bp, &seg); - if o.path.elements().len().saturating_add(bp.elements().len()) > super::build::MAX_ELEMENTS { - return None; - } - } - if !bp.elements().is_empty() { - if complete - && let (Some(end), Some(start)) = - (bp.elements().last().and_then(|e| e.end_point()), bp.elements().first().and_then(|e| e.end_point())) - { - o.broken |= endpoints_apart(end, start); - } - // A loop of one curve ending where it starts is split in two: as one - // segment, its start and end would become one anchor. - if let [seg] = bp.segments().collect::>()[..] - && !matches!(seg, PathSeg::Line(_)) - { - let (a, b) = seg.subdivide(); - bp = BezPath::from_path_segments([a, b].into_iter()); - } - bp.close_path(); - if o.path.elements().len().saturating_add(bp.elements().len()) > super::build::MAX_ELEMENTS { - return None; - } - o.path.extend(bp); - } - } - } - } - } - } - let ok = !o.path.elements().is_empty() && curve::bounds(&o.path).is_some(); - ok.then_some(o) -} - -/// A vertex's position. -fn vertex(m: &Model, p: i64) -> Option { - let v = m.get_is(p, "vertex")?; - let n = m.get_is(v.ptr(1), "point")?.nums(); - p3(&n, 0).filter(|p| p.iter().all(|c| c.is_finite())) -} - -/// The edge as a coedge runs it (`reversed`: from its end vertex to its start), from the first -/// point. -fn edge_path(m: &Model, edge: &Rec, reversed: bool, xf: &Xf, approximated: &mut bool) -> Option<(BezPath, bool)> { - let (sv, ev) = (vertex(m, edge.ptr(0))?, vertex(m, edge.ptr(1))?); - let closed = edge.ptr(0) == edge.ptr(1); - let (from, to) = if reversed { (ev, sv) } else { (sv, ev) }; - // Against the curve's own direction? - let back = edge.sense_after(3)? != reversed; - let drawn = match m.get(edge.ptr(3)) { - // Only -1 means the edge has no curve. - None => { - *approximated |= edge.ptr(3) != -1; - None - } - Some(c) if c.is("straight-curve") => None, - Some(c) => { - let bp = if c.is("ellipse-curve") { - ellipse(c, from, to, closed, back, xf).map(|bp| (bp, false)) - } else if c.is("intcurve-curve") { - spline(c, from, to, closed, back, xf) - } else { - None - }; - *approximated |= bp.is_none(); - bp - } - }; - if let Some(bp) = drawn { - return Some(bp); - } - let mut bp = BezPath::new(); - bp.move_to(flat(xf.point(from))); - bp.line_to(flat(xf.point(to))); - Some((bp, false)) -} - -/// An `ellipse-curve` (centre, normal, major axis, ratio) from `from` to `to`; the whole curve -/// when the edge starts and ends at one vertex. It runs counter-clockwise about its normal, -/// clockwise when `back`. -fn ellipse(c: &Rec, from: P3, to: P3, closed: bool, back: bool, xf: &Xf) -> Option { - let n = c.nums(); - let (centre, normal, major, ratio) = (p3(&n, 0)?, p3(&n, 3)?, p3(&n, 6)?, *n.get(9)?); - let len = dot(normal, normal).sqrt(); - if !(len > 1e-12 && ratio > 0.0 && ratio.is_finite() && dot(major, major) > 1e-24) { - return None; - } - let minor = cross(normal, major).map(|v| v / len * ratio); - let angle = |p: P3| { - let d = sub(p, centre); - (dot(d, minor) / dot(minor, minor)).atan2(dot(d, major) / dot(major, major)) - }; - let (a, b) = (angle(from), angle(to)); - let tau = std::f64::consts::TAU; - let sweep = match (closed, back) { - (true, false) => tau, - (true, true) => -tau, - (false, false) => (b - a).rem_euclid(tau), - (false, true) => -(a - b).rem_euclid(tau), - }; - let (o, u, v) = (flat(xf.point(centre)), flat(xf.vector(major)), flat(xf.vector(minor))); - curve::ellipse(Affine::new([u.x, u.y, v.x, v.y, o.x, o.y]), a, sweep) -} - -/// An `intcurve-curve`'s B-spline (`nubs`, or `nurbs` with weights): degree, form, the knots -/// with their multiplicities (without the end knots, or with them), the control points. -fn bspline(toks: &[Tok]) -> Option { - let at = toks.iter().position(|t| matches!(t, Tok::Word(w) if matches!(w.as_str(), "nubs" | "nurbs" | "nullbs")))?; - let rational = match &toks[at] { - Tok::Word(w) if w == "nurbs" => true, - Tok::Word(w) if w == "nubs" => false, - _ => return None, - }; - let num = |i: usize| if let Some(Tok::Num(v)) = toks.get(i) { Some(*v) } else { None }; - let degree = num(at + 1).filter(|d| (1.0..=32.0).contains(d))? as usize; - let count = num(at + 3).filter(|n| *n >= 1.0 && *n <= toks.len() as f64)? as usize; - let mut knots = vec![]; - let mut i = at + 4; - for _ in 0..count { - let (k, mult) = (num(i)?, num(i + 1)?); - if !(mult >= 1.0 && mult <= (degree + 1) as f64) { - return None; - } - knots.extend(std::iter::repeat_n(k, mult as usize)); - i += 2; - } - let stride = if rational { 4 } else { 3 }; - let values: Vec = toks[i.min(toks.len())..].iter().map_while(|t| if let Tok::Num(v) = t { Some(*v) } else { None }).collect(); - let available = values.len() / stride; - // The data leaves out the first and last knots; data that keeps them has two points fewer. - let short = (knots.len() + 1).checked_sub(degree)?; - let n = if available >= short { - let (first, last) = (*knots.first()?, *knots.last()?); - knots.insert(0, first); - knots.push(last); - short - } else { - knots.len().checked_sub(degree + 1)? - }; - if n == 0 || n > available { - return None; - } - let pts = values.chunks(stride).take(n).map(|c| [c[0], c[1], c[2]]).collect(); - let weights = rational.then(|| values.chunks(stride).take(n).map(|c| c[3]).collect()); - Some((degree, knots, pts, weights)) -} - -/// The distinct parameters of a cubic's self-intersection, when both lie on the curve. -fn cubic_crossing(cubic: kurbo::CubicBez) -> Option<(f64, f64)> { - let b = (cubic.p1 - cubic.p0) * 3.0; - let c = (cubic.p2 - cubic.p1) * 3.0 - b; - let d = (cubic.p3 - cubic.p0) - b - c; - let det = c.cross(d); - if det == 0.0 { - return None; - } - // Dividing P(s) - P(t) by s - t gives b + c*u + d*(u*u - v) = 0, - // where u = s + t and v = s*t. - let u = -b.cross(d) / det; - let v = u * u - b.cross(c) / det; - let discriminant = u * u - 4.0 * v; - if !discriminant.is_finite() || discriminant <= 0.0 { - return None; - } - let root = discriminant.sqrt(); - let (s, t) = ((u - root) * 0.5, (u + root) * 0.5); - (0.0 <= s && s < t && t <= 1.0).then_some((s, t)) -} - -/// An `intcurve-curve` from `from` to `to` (the part of its spline between them), the whole -/// ring when the edge starts and ends at one vertex; also whether trimming is ambiguous. -fn spline(c: &Rec, from: P3, to: P3, closed: bool, back: bool, xf: &Xf) -> Option<(BezPath, bool)> { - // The curve's own sense comes before its data. - let open = c.toks.iter().position(|t| *t == Tok::Open)?; - let curve_back = c.toks[..open].contains(&Tok::Sense(true)); - let (degree, knots, pts, weights) = bspline(&c.toks[open..])?; - let ctrl: Vec = pts.into_iter().map(|p| flat(xf.point(p))).collect(); - let full = curve::nurbs(degree, &knots, &ctrl, weights.as_deref())?; - let back = back != curve_back; - let segs: Vec = full.segments().collect(); - let (first, last) = (segs.first()?.start(), segs.last()?.end()); - let ring = first.distance(last) <= 1e-9 * (1.0 + first.to_vec2().hypot()); - let mut lengths = vec![0.0]; - for s in &segs { - lengths.push(lengths.last()? + s.arclen(1e-9)); - } - let total = *lengths.last()?; - let at = |p: P3| { - let p = flat(xf.point(p)); - let near: Vec<_> = segs.iter().enumerate().map(|(i, s)| (s.nearest(p, 1e-9), i)).collect(); - let (n, i) = near.iter().min_by(|a, b| a.0.distance_sq.total_cmp(&b.0.distance_sq))?; - let along = |i: usize, t: f64| lengths[i] + segs[i].subsegment(0.0..t).arclen(1e-9); - let tolerance = 1e-6 * (1.0 + p.x.hypot(p.y)); - let mut locations: Vec<_> = - near.iter().filter(|(n, i)| !endpoints_apart(p, segs[*i].eval(n.t))).map(|(n, i)| (*i as f64 + n.t, along(*i, n.t))).collect(); - for (i, s) in segs.iter().enumerate() { - if let PathSeg::Cubic(cubic) = s - && let Some((a, b)) = cubic_crossing(*cubic) - && !endpoints_apart(p, cubic.eval(a)) - { - locations.extend([a, b].map(|t| (i as f64 + t, along(i, t)))); - } - } - // Nearby ends at a segment joint, or at a closed curve's seam, are one location. - locations.sort_by(|a, b| a.0.total_cmp(&b.0)); - locations.dedup_by(|a, b| (a.1 - b.1).abs() <= 4.0 * tolerance); - if ring && locations.len() > 1 && (total - (locations.last()?.1 - locations.first()?.1)).abs() <= 4.0 * tolerance { - locations.pop(); - } - Some((*i as f64 + n.t, locations)) - }; - let mut ambiguous = false; - let part = if closed && ring { - let (_, locations) = at(from)?; - ambiguous = locations.len() > 1; - full - } else { - let bounds = if closed { - let (_, locations) = at(from)?; - if let [a, b] = locations.as_slice() { - Some((a.0, b.0)) - } else { - ambiguous = true; - None - } - } else { - let ((ga, a), (gb, b)) = (at(from)?, at(to)?); - ambiguous = a.len() > 1 || b.len() > 1; - Some((ga, gb)) - }; - if let Some((ga, gb)) = bounds { - let (lo, hi) = if back { (gb, ga) } else { (ga, gb) }; - let pieces = if lo <= hi || !ring { - piece(&segs, lo.min(hi), hi.max(lo)) - } else { - [piece(&segs, lo, segs.len() as f64), piece(&segs, 0.0, hi)].concat() - }; - if pieces.is_empty() { - return None; - } - BezPath::from_path_segments(pieces.into_iter()) - } else { - full - } - }; - Some((if back { part.reverse_subpaths() } else { part }, ambiguous)) -} - -/// The parts of `segs` from `lo` to `hi`, counted in segments (2.5: halfway along the third). -fn piece(segs: &[PathSeg], lo: f64, hi: f64) -> Vec { - let mut out = vec![]; - for (i, s) in segs.iter().enumerate() { - let (t0, t1) = ((lo - i as f64).max(0.0), (hi - i as f64).min(1.0)); - if t1 > t0 { - out.push(s.subsegment(t0..t1)); - } - } - out -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn cubic_crossings_have_two_distinct_parameters() { - let cubic = kurbo::CubicBez::new((36.0, -18.0), (-28.0, 26.0), (-28.0, -26.0), (36.0, 18.0)); - let (s, t) = cubic_crossing(cubic).unwrap(); - assert!((s - 0.25).abs() < 1e-12 && (t - 0.75).abs() < 1e-12, "{s}, {t}"); - let plain = kurbo::CubicBez::new((0.0, 0.0), (30.0, 50.0), (70.0, -50.0), (100.0, 0.0)); - assert!(cubic_crossing(plain).is_none()); - } - - #[test] - fn deciphering_maps_each_character_back_and_drops_the_caret_space() { - // "Ab@_ 7#" ciphered: A→^ (and a space), b→=, @→_, _→@, 7→h, #→|. - assert_eq!(decipher("^ =_@ h|"), "Ab@_ 7#"); - } -} diff --git a/crates/cad/src/import/entity.rs b/crates/cad/src/import/entity.rs index bfe6fe9bd3..d61e001632 100644 --- a/crates/cad/src/import/entity.rs +++ b/crates/cad/src/import/entity.rs @@ -8,9 +8,10 @@ use kurbo::{BezPath, ParamCurve, ParamCurveDeriv, PathEl, PathSeg, Shape}; use vectorcraft_doc::Justify; use vectorcraft_geom::{Affine, Point, Vec2}; +use craft_dxf::acis; use craft_dxf::model::{self, EntityRecord, Groups, HatchEdge, HatchPath}; -use super::acis; +use super::build::MAX_ELEMENTS; use super::curve::{self, Vertex}; use super::hatch::{self, Grad, NoPattern}; use super::reader::{aci_paper, point}; @@ -478,26 +479,12 @@ impl Converter { /// A region as a filled path: its solid-modeler data as text in groups 1 (a line each) and 3 /// (the rest of a long line), or, from DXF 2013 on, binary data kept by handle. fn region(&mut self, e: &EntityRecord<'_>) -> Option { - let g = e.groups(); - let own = g.subclass("AcDbModelerGeometry"); - let tags = if own.0.is_empty() { g.0 } else { own.0 }; - let mut text = String::new(); - for t in tags { - match t.code { - 1 => { - if !text.is_empty() { - text.push('\n'); - } - text.push_str(t.str_ref().unwrap_or_default()); - } - 3 => text.push_str(t.str_ref().unwrap_or_default()), - _ => {} - } - if text.len() > acis::MAX_BYTES { - return None; - } - } - let outline = if text.trim().is_empty() { acis::from_binary(self.regions.get(&e.record().handle()?)?) } else { acis::from_text(&text) }?; + let text = acis::text_data(e)?; + let outline = if text.trim().is_empty() { + acis::from_binary(self.regions.get(&e.record().handle()?)?, MAX_ELEMENTS) + } else { + acis::from_text(&text, MAX_ELEMENTS) + }?; if outline.approximated { self.warn(REGION_CURVES); } diff --git a/crates/cad/src/import/reader.rs b/crates/cad/src/import/reader.rs index 1adc71c563..da72ec714c 100644 --- a/crates/cad/src/import/reader.rs +++ b/crates/cad/src/import/reader.rs @@ -1,7 +1,7 @@ //! What the import uses of a drawing, from `craft_dxf::model`: header variables; the layer, //! linetype and text style tables; the blocks; the entities; the layouts; the image files. -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use std::rc::Rc; use craft_dxf::model::{self, EntityRecord}; @@ -132,7 +132,7 @@ impl<'a> Drawing<'a> { d.images.entry(h).or_insert(ImageFile { path: def.file, size: def.size }); } } - d.regions = Rc::new(region_data(&doc)); + d.regions = Rc::new(craft_dxf::acis::binary_data(&doc)); for b in doc.blocks { if b.name.is_empty() { continue; @@ -169,69 +169,6 @@ impl<'a> Drawing<'a> { } } -/// The binary data of each region in the ACDSDATA section: an `ACDSRECORD` names its entity's -/// handle (320), then holds the bytes (310 chunks) after `2 ASM_Data`, their count in 94. -fn region_data(doc: &model::Document<'_>) -> HashMap> { - let records = doc.entities.iter().chain(doc.blocks.iter().flat_map(|b| &b.entities)); - let wanted: HashSet = records.filter(|e| e.kind == "REGION").filter_map(|e| e.record().handle()).collect(); - let mut out = HashMap::new(); - if wanted.is_empty() { - return out; - } - for section in doc.other_sections.iter().filter(|s| s.name.eq_ignore_ascii_case("ACDSDATA")) { - for r in model::records(section.tags).into_iter().filter(|r| r.kind == "ACDSRECORD") { - let Some(handle) = r.tags.iter().find(|t| t.code == 320).and_then(|t| model::parse_handle(&t.str())) else { continue }; - if !wanted.contains(&handle) || out.contains_key(&handle) { - continue; - } - let Some(at) = r.tags.iter().position(|t| t.code == 2 && t.str_ref().is_some_and(|s| s.trim() == "ASM_Data")) else { continue }; - let data = r.tags.get(at + 1..).unwrap_or_default(); - let size = data.iter().find(|t| t.code == 94).and_then(|t| usize::try_from(t.i64()).ok()); - let mut bytes = Vec::new(); - let mut whole = true; - for t in data.iter().filter(|t| t.code == 310) { - whole = hex_bytes(t.str_ref().unwrap_or_default().trim(), &mut bytes); - if !whole || bytes.len() > super::acis::MAX_BYTES { - break; - } - } - if !whole { - continue; - } - if let Some(bytes) = sized_region(bytes, size, super::acis::MAX_BYTES) { - out.insert(handle, bytes); - } - } - } - out -} - -/// A region's `bytes` cut to its declared `size`, or `None` when the record declares more bytes -/// than it holds (the data was cut short or damaged) or the data is longer than `limit`. -pub(super) fn sized_region(mut bytes: Vec, size: Option, limit: usize) -> Option> { - match size { - Some(n) if n <= bytes.len() => bytes.truncate(n), - Some(_) => return None, - None => {} - } - (bytes.len() <= limit).then_some(bytes) -} - -/// Hex digits' bytes, two digits each, onto `out`. False when `hex` has a character that is not -/// a hex digit or an odd number of digits. -pub(super) fn hex_bytes(hex: &str, out: &mut Vec) -> bool { - let digit = |c: u8| (c as char).to_digit(16).and_then(|d| u8::try_from(d).ok()); - let (pairs, rest) = hex.as_bytes().as_chunks::<2>(); - if !rest.is_empty() { - return false; - } - for pair in pairs { - let (Some(hi), Some(lo)) = (digit(pair[0]), digit(pair[1])) else { return false }; - out.push(hi << 4 | lo); - } - true -} - pub(crate) fn point(p: model::Point) -> Point { Point::new(p[0], p[1]) } diff --git a/crates/cad/src/import/tests_region.rs b/crates/cad/src/import/tests_region.rs index a44e02c84d..05ff83d211 100644 --- a/crates/cad/src/import/tests_region.rs +++ b/crates/cad/src/import/tests_region.rs @@ -327,20 +327,6 @@ fn binary_data_in_the_acdsdata_section_reads_alike() { short[7].1 = (bytes.len() + 1).to_string(); let r = import(&drawing("AC1032", &e, &short), &points()).unwrap(); assert!(r.warnings.iter().any(|w| w.contains("1 REGION")), "{:?}", r.warnings); - // A chunk with an odd number of digits or a character that is not a hex digit fails to read. - let mut out = Vec::new(); - assert!(super::reader::hex_bytes("0aFf", &mut out)); - assert_eq!(out, [0x0A, 0xFF]); - for hex in ["0aF", "0aZZ", "0 aF"] { - assert!(!super::reader::hex_bytes(hex, &mut Vec::new()), "{hex}"); - } - // Data longer than the limit is left out, unless its declared size cuts it within the limit. - let sized = |len: usize, size: Option| super::reader::sized_region(vec![7; len], size, 8).map(|b| b.len()); - assert_eq!(sized(10, None), None); - assert_eq!(sized(10, Some(9)), None); - assert_eq!(sized(10, Some(11)), None); - assert_eq!(sized(10, Some(5)), Some(5)); - assert_eq!(sized(8, None), Some(8)); } /// A drawing the export writes (R2000, millimetres) with a region added to its entities. diff --git a/crates/cad/src/lib.rs b/crates/cad/src/lib.rs index e4eac1b20c..4e3f65f2d8 100644 --- a/crates/cad/src/lib.rs +++ b/crates/cad/src/lib.rs @@ -27,8 +27,6 @@ #![doc(test(attr(deny(unsafe_code))))] mod aci; -// Temporary until storytold/craft-libs#5381 merges and the craft-libs pin moves past it. -mod blocks_compat; pub mod dwg; #[cfg(test)] mod expansion_test; diff --git a/crates/cad/src/scene.rs b/crates/cad/src/scene.rs index 93dc163627..68beac7f8d 100644 --- a/crates/cad/src/scene.rs +++ b/crates/cad/src/scene.rs @@ -15,9 +15,7 @@ use vectorcraft_geom::{Affine, BezPath, FillRule, PathData, Point, Rect, Vec2}; use crate::aci::nearest_aci; use crate::{CAP_HEIGHT, ColorDepth, DxfImage, DxfOptions, DxfOutput, MAX_NEST, Preserve, RasterFormat}; -// Block and the INSERT writer come from craft-libs#5381 once it merges; see `blocks_compat`. -use crate::blocks_compat::Block; -use craft_dxf::drawing::{Codes, Drawing, EntityStyle, Handle, ImageDef, Layer, LineType, STANDARD_STYLE, fixed}; +use craft_dxf::drawing::{Block, Codes, Drawing, EntityStyle, Handle, ImageDef, Layer, LineType, STANDARD_STYLE, fixed}; /// Curves are flattened to within this distance (points) where DXF needs straight segments /// (hatch boundaries, R12 polylines). @@ -597,7 +595,7 @@ impl<'a> Scene<'a> { linetypes: self.linetypes, styles: self.styles, images: self.images, - blocks: Vec::new(), + blocks: self.blocks, entities: self.e.into_string(), extents: self.extents.unwrap_or(limits), limits, @@ -605,12 +603,7 @@ impl<'a> Scene<'a> { metric: matches!(self.o.unit, Unit::Millimeters | Unit::Centimeters | Unit::Meters), next: self.next, }; - DxfOutput { - bytes: crate::blocks_compat::write(drawing, &self.blocks).into_bytes(), - images: self.files, - warnings: self.warnings, - setting_notes: self.setting_notes, - } + DxfOutput { bytes: drawing.write().into_bytes(), images: self.files, warnings: self.warnings, setting_notes: self.setting_notes } } /// Note `w`, once, about something of the document that the drawing leaves out or that reaches @@ -789,7 +782,7 @@ impl<'a> Scene<'a> { let base = symbol_name(n.name.as_deref().unwrap_or_default(), long); let base = if base.is_empty() { symbol_name("Group", long) } else { base }; let name = self.block_names.unique(&base, if long { 255 } else { 31 }); - crate::blocks_compat::insert(&mut self.e, insert, self.owner, &self.layer, &name); + self.e.insert(insert, self.owner, &self.layer, &name); self.blocks.push(Block { name, record, begin, end, entities }); } diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index a06b163888..2487dcd01d 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -17,11 +17,6 @@ bundled-fonts = ["vectorcraft-text/bundled-fonts"] # feature still recognizes the files and refuses them with a message. The apps list it beside # `bundled-fonts`. heif = ["dep:heic-rs", "dep:rayon"] -# Binary CGM files open and place. Off until the craft-metafile CGM reader (craft-libs#5410) merges -# and the workspace pins it; the build fails with this feature on before then. Without it, `.cgm` -# is not listed as readable or placeable anywhere. Turning it on also needs `cgm` in -# `UNASSOCIATED_EXTS` (`src/cmd/fileio/formats.rs`). -cgm = ["vectorcraft-metafile/cgm"] [dependencies] craft-codepage = { workspace = true } diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs index 47218dd6a1..de276328e2 100644 --- a/crates/engine/src/cmd/fileio.rs +++ b/crates/engine/src/cmd/fileio.rs @@ -247,8 +247,7 @@ mod tests_svgimport; #[cfg(test)] mod tests_eps; -// The CGM reader waits on craft-libs#5410 (the `cgm` feature). -#[cfg(all(test, feature = "cgm"))] +#[cfg(test)] mod tests_cgm; #[cfg(test)] mod tests_dwgimport; diff --git a/crates/engine/src/cmd/fileio/formats.rs b/crates/engine/src/cmd/fileio/formats.rs index 81eb502f22..0fab10d8af 100644 --- a/crates/engine/src/cmd/fileio/formats.rs +++ b/crates/engine/src/cmd/fileio/formats.rs @@ -588,8 +588,7 @@ pub const FORMATS: &[Format] = &[ options: metafile::OPTIONS, }, // Binary Computer Graphics Metafiles, read by `vectorcraft_metafile::import_cgm` into paths, - // type and images. Behind the `cgm` feature until craft-libs#5410 merges. - #[cfg(feature = "cgm")] + // type and images. reader("cgm", "CGM", &["cgm"], "image/cgm", false), // Layered raster `.pcraft` documents, read by `pcraftread` as one image: the full-size // composite, the layers combined, or the preview with a note. Exports don't write them. @@ -664,7 +663,6 @@ pub const OPEN_EXTS: &[&str] = &[ "pct", "pic", "pict", - #[cfg(feature = "cgm")] "cgm", "plt", "hpgl", @@ -691,12 +689,11 @@ pub const OPEN_EXTS: &[&str] = &[ /// names of PNG, BMP and JPEG files (File › Open and Place still read them all). On Linux the desktop /// entry's EPS and JPEG types (shared-mime-info's) also cover `.epsf` and `.jpe`, so file managers /// offer VectorCraft for them. -/// The packaging declares no type for HP-GL plot files, PICT pictures, layered raster `.pcraft` -/// documents or DWG drawings (`.dwg`, `.dws` and `.dwt`) either. CGM files are added here -/// when the `cgm` feature is turned on (craft-libs#5410). +/// The packaging declares no type for HP-GL plot files, PICT pictures, CGM files, layered raster +/// `.pcraft` documents or DWG drawings (`.dwg`, `.dws` and `.dwt`) either. pub const UNASSOCIATED_EXTS: &[&str] = &[ "psd", "pdd", "psb", "epsf", "ps", "pns", "dib", "rle", "jpe", "tga", "vda", "icb", "vst", "pcx", "pxr", "jpf", "jpx", "jp2", "j2k", "j2c", - "jpc", "heic", "heif", "jxl", "cdr", "cdt", "cmx", "plt", "hpgl", "hgl", "hpg", "pct", "pic", "pict", "pcraft", "dwg", "dws", "dwt", + "jpc", "heic", "heif", "jxl", "cdr", "cdt", "cmx", "plt", "hpgl", "hgl", "hpg", "pct", "pic", "pict", "cgm", "pcraft", "dwg", "dws", "dwt", ]; /// The extension that picks each writable format when exporting (the format's first; PNG-8 shares @@ -783,7 +780,6 @@ pub const PLACE_EXTS: &[&str] = &[ "pct", "pic", "pict", - #[cfg(feature = "cgm")] "cgm", "plt", "hpgl", diff --git a/crates/engine/src/cmd/fileio/native.rs b/crates/engine/src/cmd/fileio/native.rs index 41649366f1..b116399d98 100644 --- a/crates/engine/src/cmd/fileio/native.rs +++ b/crates/engine/src/cmd/fileio/native.rs @@ -26,8 +26,8 @@ pub const OPTIONS: &[FormatOption] = &[ FormatOption { name: "version", ty: "integer", - default: "4", - description: "the format version to write: 4 (current), or 3, 2 or 1 for older VectorCraft versions (1 and 2 are never compressed; newer features they don't know are lost there)", + default: "5", + description: "the format version to write: 5 (current), or 4, 3, 2 or 1 for older VectorCraft versions (1 and 2 are never compressed; newer features they don't know are lost there)", }, FormatOption { name: "preview", @@ -202,7 +202,7 @@ pub(super) fn encode(cmd: &str, f: &Format, doc: &Document, p: &Value) -> Result pub(super) fn encode_to(cmd: &str, f: &Format, doc: &Document, p: &Value, w: impl std::io::Write) -> Result<()> { let (mut so, extras) = save_options(cmd, f, doc, p)?; // Include Linked Files keeps placed documents' files; older versions get their art. - let full = if so.include_linked || so.version < vectorcraft_format::VERSION { + let full = if so.include_linked || so.version < vectorcraft_format::PLACED_SINCE { crate::cmd::place::document::full_documents(doc).0 } else { std::borrow::Cow::Borrowed(doc) @@ -223,7 +223,7 @@ pub(super) fn encode_to(cmd: &str, f: &Format, doc: &Document, p: &Value, w: imp } drop(drawn); let native = match full { - Cow::Owned(full) if so.include_linked && so.version >= vectorcraft_format::VERSION => { + Cow::Owned(full) if so.include_linked && so.version >= vectorcraft_format::PLACED_SINCE => { // Include available bytes without replacing missing, relinkable placed objects. let mut original = doc.clone(); original.images = full.images; @@ -242,7 +242,7 @@ pub(super) fn encode_to(cmd: &str, f: &Format, doc: &Document, p: &Value, w: imp /// groups of their art for older versions. fn rounded(doc: &Document, version: u32, decimals: u8) -> Document { let mut d = doc.clone(); - if version < vectorcraft_format::VERSION { + if version < vectorcraft_format::PLACED_SINCE { vectorcraft_format::placed_as_groups(&mut d); } d.round_geometry(decimals.min(vectorcraft_format::MAX_PRECISION)); diff --git a/crates/engine/src/cmd/fileio/tests_pdffidelity.rs b/crates/engine/src/cmd/fileio/tests_pdffidelity.rs index 2541225a79..633f0558c0 100644 --- a/crates/engine/src/cmd/fileio/tests_pdffidelity.rs +++ b/crates/engine/src/cmd/fileio/tests_pdffidelity.rs @@ -476,7 +476,7 @@ fn placed_carried_fonts_survive_break_link_and_older_version_save() { assert_eq!(embedded["embedded"], json!([id.0]), "{embedded}"); assert_eq!(glyphs(&s).1, 1); } - let version = if break_link { vectorcraft_format::VERSION } else { vectorcraft_format::VERSION - 1 }; + let version = if break_link { vectorcraft_format::VERSION } else { vectorcraft_format::PLACED_SINCE - 1 }; let saved = s.execute("document.serialize", &json!({"format": "vectorcraft", "version": version, "preview": false})).unwrap(); let reopened = s.execute("document.open", &json!({"name": "placed-font.vectorcraft", "dataBase64": saved["dataBase64"]})).unwrap(); assert!(reopened["warnings"].as_array().unwrap().is_empty(), "{reopened}"); diff --git a/crates/engine/src/tests/placed_document.rs b/crates/engine/src/tests/placed_document.rs index 5166c820c4..73a4a1a21b 100644 --- a/crates/engine/src/tests/placed_document.rs +++ b/crates/engine/src/tests/placed_document.rs @@ -1507,7 +1507,7 @@ fn saved_for_older_apps_placed_documents_in_brush_art_become_their_art() { n }; let prefix = vectorcraft_doc::placed_document::RESOURCE_PREFIX; - let older = vectorcraft_format::VERSION - 1; + let older = vectorcraft_format::PLACED_SINCE - 1; let old = vectorcraft_format::load(&decode(&s.execute("document.serialize", &json!({"format": "vectorcraft", "version": older})).unwrap())).unwrap(); assert_eq!(placed_in_brushes(&old), 0, "{}", old.unknown[vectorcraft_brush::DOC_KEY]); @@ -1519,6 +1519,8 @@ fn saved_for_older_apps_placed_documents_in_brush_art_become_their_art() { let current = vectorcraft_format::load(&decode(&s.execute("document.serialize", &json!({"format": "vectorcraft"})).unwrap())).unwrap(); assert_eq!(placed_in_brushes(¤t), 2, "the current version keeps them placed"); assert!(current.symbols.iter().all(|s| !s.name.starts_with(prefix))); + let v4 = vectorcraft_format::load(&decode(&s.execute("document.serialize", &json!({"format": "vectorcraft", "version": 4})).unwrap())).unwrap(); + assert_eq!(placed_in_brushes(&v4), 2, "version 4 keeps them placed too"); // With a precision, the preview shows the brushes' art as the file holds it, rounded. let file = decode(&s.execute("file.saveCopy", &json!({"version": older, "precision": 0, "preview": true})).unwrap()); let saved = vectorcraft_format::load(&file).unwrap(); diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index edc89b319b..3dd3c406ac 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -4161,10 +4161,7 @@ proptest! { // ---------- Binary CGM files: opened and placed ---------- -// The CGM reader waits on craft-libs#5410: everything here is behind the `cgm` feature. - /// One CGM element, in the long form past 30 bytes, padded to an even length. -#[cfg(feature = "cgm")] fn cgm_el(class: u16, id: u16, data: &[u8]) -> Vec { let mut b = Vec::new(); if data.len() < 31 { @@ -4181,7 +4178,6 @@ fn cgm_el(class: u16, id: u16, data: &[u8]) -> Vec { } /// A metafile of one picture holding `body`. -#[cfg(feature = "cgm")] fn cgm_of(body: &[(u16, u16, Vec)]) -> Vec { let mut b = cgm_el(0, 1, b"\x01x"); b.extend(cgm_el(1, 1, &be16(&[3]))); @@ -4198,7 +4194,6 @@ fn cgm_of(body: &[(u16, u16, Vec)]) -> Vec { } /// A picture with lines, shapes, arcs, a figure, markers, text, a cell array and a clip. -#[cfg(feature = "cgm")] fn cgm_sample() -> Vec { cgm_of(&[ (5, 34, vec![8, 10, 20, 30, 40, 50, 60]), @@ -4232,7 +4227,6 @@ fn cgm_sample() -> Vec { } /// The sample the mutations start from opens with art, type and an image. -#[cfg(feature = "cgm")] #[test] fn the_cgm_sample_opens() { let l = vectorcraft_engine::cmd::fileio::load("x.cgm", &cgm_sample()).unwrap(); @@ -4249,14 +4243,12 @@ fn the_cgm_sample_opens() { /// CGM elements VectorCraft reads, and some it skips: the class in the high byte, the id in the /// low one. -#[cfg(feature = "cgm")] const CGM_ELEMENTS: [u16; 44] = [ 0x0008, 0x0009, 0x0103, 0x0104, 0x0105, 0x0107, 0x010A, 0x010C, 0x010D, 0x0113, 0x0201, 0x0202, 0x0203, 0x0207, 0x0301, 0x0302, 0x0305, 0x0306, 0x030A, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040B, 0x040C, 0x040D, 0x040F, 0x0411, 0x0412, 0x0414, 0x0418, 0x041A, 0x0503, 0x0504, 0x050F, 0x0510, 0x0512, 0x0522, 0x0801, ]; -#[cfg(feature = "cgm")] proptest! { #![proptest_config(config())] diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs index 9ecba0c7ca..8b6e383dfe 100644 --- a/crates/format/src/lib.rs +++ b/crates/format/src/lib.rs @@ -33,9 +33,9 @@ //! The document has a version of its own (`document.version`, [`vectorcraft_doc::FORMAT_VERSION`]), //! which readers do not check. A version 2 document's Twist effects turn clockwise for a positive //! angle. A version 1 document's Twist angles are negated when it opens, unless the file is of -//! [`VERSION`] and its `generator` is VectorCraft 0.21.0 or later, which turned them clockwise -//! already; [`save_with`] writes a version 1 document with them negated back for an older file -//! version ([`vectorcraft_doc::twist`]). +//! [`PLACED_SINCE`] or later and its `generator` is VectorCraft 0.21.0 or later, which turned them +//! clockwise already; [`save_with`] writes a version 1 document with them negated back for a file +//! version older than [`PLACED_SINCE`] ([`vectorcraft_doc::twist`]). #![forbid(unsafe_code)] #![doc(test(attr(forbid(unsafe_code))))] @@ -64,11 +64,16 @@ use craft_gzip::Gz; pub use craft_vectorcraft_format::base64::{decode as base64_decode, decoded_len as base64_decoded_len, encode as base64_encode}; use craft_vectorcraft_format::stream::{FileHeader, Indent, KeyScan, write_file_json}; pub use craft_vectorcraft_format::{ - BLOB_MAGIC, COMPRESSED_SINCE, EXTENSION, ICC_MIME, INLINE_MAX, LEGACY_EXTENSION, MIN_VERSION, PREVIEW_MAX, VERSION, is_compressed, json_part, - sniff, + BLOB_MAGIC, COMPRESSED_SINCE, EXTENSION, ICC_MIME, INLINE_MAX, LEGACY_EXTENSION, LIVE_STAR_SINCE, MIN_VERSION, PREVIEW_MAX, VERSION, + is_compressed, json_part, sniff, }; use stream::Out; +/// The first version whose files keep placed documents, Color Halftone's Max Radius in pixels and +/// Twist angles as they are. A save for an older version writes placed documents as the art they +/// show, the radius in points and Twist angles negated back, as apps of those versions read them. +pub const PLACED_SINCE: u32 = 4; + /// Most bytes the JSON of a compressed file may unpack to (a guard against decompression bombs, /// as are [`MAX_BLOB`] and [`MAX_BLOBS`]). A compressed save refuses a document past any of them, /// so every file VectorCraft writes reads back. On wasm32 the cap is a quarter of the native @@ -252,7 +257,7 @@ fn body(doc: &Document, o: &SaveOptions) -> Result { // resources. Otherwise resources only exporting adds are never saved. The images and placed // documents in the stored brushes' art count as those in the layers do. let linked = with_brush_art(&mut d, |d| { - if version < VERSION { + if version < PLACED_SINCE { placed_as_groups(d); } else { d.drop_placed_resources(); @@ -268,15 +273,15 @@ fn body(doc: &Document, o: &SaveOptions) -> Result { if version < 3 { d.store_legacy_color_profiles(); } - // Apps before this one's version take Color Halftone's Max Radius in points (#3260), and - // predate 0.21.0, turning Twist the other way. The radii first: their conversion runs only on - // a document of version 3 or later, and the Twist one then marks it version 1. - if version < VERSION { + // Apps before version 4 take Color Halftone's Max Radius in points (#3260), and predate + // 0.21.0, turning Twist the other way. The radii first: their conversion runs only on a + // document of version 3 or later, and the Twist one then marks it version 1. + if version < PLACED_SINCE { d.halftone_radii_to_points(); d.store_legacy_twist_angles(); } // Older apps don't know live stars: they get the outline a star draws as a plain path. - if version < VERSION { + if version < LIVE_STAR_SINCE { d.live_stars_to_paths(); } let v1 = if version == 1 { @@ -309,7 +314,7 @@ pub fn with_brush_art(d: &mut Document, f: impl FnOnce(&mut Document) -> T) - /// Every placed document in `d`'s art, the art of its stored brushes included, replaced by a group /// of the art it shows, with the resources that art uses, as a save for a version older than -/// [`VERSION`] writes it. Without a placed document, the resources only exporting adds are dropped +/// [`PLACED_SINCE`] writes it. Without a placed document, the resources only exporting adds are dropped /// ([`Document::drop_placed_resources`]). pub fn placed_as_groups(d: &mut Document) { with_brush_art(d, |d| { @@ -576,7 +581,7 @@ fn load_unpacked(file: unpack::Unpacked<'_>, max_nodes: usize, max_values: usize // version): its Twist angles turned the other way. The app that wrote it is read from the JSON // before the data after it is taken; the walk's depth is bounded by the JSON reader's nesting // limit. - let current_file = f.version >= VERSION; + let current_file = f.version >= PLACED_SINCE; f.document.migrate_twist_angles(|| current_file && vectorcraft_doc::twist::written_clockwise(generator(file.json()).as_deref())); // The bytes after the JSON, read in one pass: the images' first, then the profiles'. let entries: Vec<[u64; 2]> = f.images.values().chain(f.profiles.values()).filter_map(|i| i.blob).collect(); @@ -1128,7 +1133,8 @@ mod tests { } } } - assert_eq!(checked, 20); + // Four for each version, and two compressed for each version from 3. + assert_eq!(checked, 4 * (VERSION - MIN_VERSION + 1) + 2 * (VERSION - COMPRESSED_SINCE + 1)); } /// Files are read through the crate's `Contents` with the messages VectorCraft gave before, @@ -1148,7 +1154,10 @@ mod tests { let doc = v["document"].to_string(); let file = |format: &str, version: u32| format!(r#"{{"format":"{format}","version":{version},"document":{doc}}}"#); assert_eq!(message(&file("svg", 4)).as_deref(), Some("not a VectorCraft file: format is `svg`")); - assert_eq!(message(&file("vectorcraft", 9)).as_deref(), Some("file version 9 is newer than this VectorCraft supports (4)")); + assert_eq!( + message(&file("vectorcraft", 9)).as_deref(), + Some(format!("file version 9 is newer than this VectorCraft supports ({VERSION})").as_str()) + ); // A document that does not read is reported first, as before. assert!( message(r#"{"format":"vectorcraft","version":9,"document":7}"#).is_some_and(|m| m.starts_with("not a VectorCraft file: invalid type")) @@ -1188,15 +1197,16 @@ mod tests { let old = load(&save(&d, false)).unwrap(); assert_eq!(old.version, vectorcraft_doc::FORMAT_VERSION); assert!((radius(&old) - 8.0 * ppi / 72.0).abs() < 1e-9, "8 pt at {ppi} ppi: {}", radius(&old)); - // Saved for an older app, in every older version: the radius in points, which opens - // here in pixels again. + // Saved for an older app, in every version before 4: the radius in points, which opens + // here in pixels again. Version 4 and later keep it in pixels. let px = radius(&old); - for version in MIN_VERSION..VERSION { + for version in MIN_VERSION..=VERSION { let bytes = save_with(&old, &SaveOptions { version, ..SaveOptions::default() }).unwrap(); let json = String::from_utf8(unpack::Unpacked::new(&bytes).unwrap().json().to_vec()).unwrap(); let at = json.find("\"maxRadius\":").unwrap() + "\"maxRadius\":".len(); let saved: f64 = json[at..].split([',', '}']).next().unwrap().trim().parse().unwrap(); - assert!((saved - 8.0).abs() < 1e-9, "{ppi} ppi, version {version} holds 8 pt: {saved}"); + let want = if version < 4 { 8.0 } else { px }; + assert!((saved - want).abs() < 1e-9, "{ppi} ppi, version {version} holds {want}: {saved}"); let back = load(&bytes).unwrap(); assert!((radius(&back) - px).abs() < 1e-9, "{ppi} ppi, version {version}: {}", radius(&back)); } @@ -1410,15 +1420,20 @@ mod tests { let again = load(&save(&old, false)).unwrap(); assert_eq!((again.version, angle(&again)), (now, Some(-30.0)), "saved again, it is the current version"); // Saved for an older file version (apps before 0.21.0): version 1 with the angle negated - // back, whatever the generator, and it reopens as it was. - for version in MIN_VERSION..VERSION { + // back, whatever the generator, and it reopens as it was. Version 4 and later keep it. + for version in MIN_VERSION..=VERSION { let bytes = save_with(&d, &SaveOptions { version, ..SaveOptions::default() }).unwrap(); let v: serde_json::Value = serde_json::from_slice(&bytes).unwrap(); - assert_eq!(v["document"]["version"], 1, "file version {version}"); - assert!(String::from_utf8_lossy(&bytes).contains(r#""angle":-30.0"#), "file version {version}"); + let (document, saved) = if version < 4 { (1, r#""angle":-30.0"#) } else { (now, r#""angle":30.0"#) }; + assert_eq!(v["document"]["version"], document, "file version {version}"); + assert!(String::from_utf8_lossy(&bytes).contains(saved), "file version {version}"); let back = load(&bytes).unwrap(); assert_eq!((back.version, angle(&back)), (now, Some(30.0)), "file version {version}"); } + // A version 4 file from 0.21.0 or later turned its version 1 document's angles already. + let mut v4: serde_json::Value = serde_json::from_slice(¤t).unwrap(); + (v4["version"], v4["document"]["version"], v4["generator"]) = (4.into(), 1.into(), "VectorCraft 0.25.2".into()); + assert_eq!(angle(&load(&serde_json::to_vec(&v4).unwrap()).unwrap()), Some(30.0)); } #[test] diff --git a/crates/format/tests/it/native_v4.rs b/crates/format/tests/it/native_v4.rs index 0a41b2d9e7..033a116d9d 100644 --- a/crates/format/tests/it/native_v4.rs +++ b/crates/format/tests/it/native_v4.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use serde_json::Value; use vectorcraft_doc::{Document, ImageBlob, ImageObject, Node, NodeKind}; -use vectorcraft_format::{BLOB_MAGIC, FormatError, INLINE_MAX, SaveOptions, load, load_file, pdf_content, save_with}; +use vectorcraft_format::{BLOB_MAGIC, FormatError, INLINE_MAX, SaveOptions, VERSION, load, load_file, pdf_content, save_with}; use vectorcraft_geom::Affine; /// A document showing image `key` of `len` bytes. @@ -48,7 +48,7 @@ fn small_files_stay_plain_json_and_older_versions_inline() { let small = save_with(&doc_with_image("small", 100), &SaveOptions::default()).unwrap(); assert!(!has_tail(&small)); let v: Value = serde_json::from_slice(&small).unwrap(); - assert_eq!(v["version"], 4); + assert_eq!(v["version"], VERSION); let big = doc_with_image("big", INLINE_MAX + 10); let v3 = save_with(&big, &SaveOptions { version: 3, ..SaveOptions::default() }).unwrap(); assert!(!has_tail(&v3), "version 3 keeps everything in the JSON"); diff --git a/crates/format/tests/prop_format.rs b/crates/format/tests/prop_format.rs index 26d91ccf97..2af73ca3a5 100644 --- a/crates/format/tests/prop_format.rs +++ b/crates/format/tests/prop_format.rs @@ -136,7 +136,7 @@ proptest! { without_live_stars(&mut older); for o in [SaveOptions { compress: true, ..SaveOptions::default() }, SaveOptions { version: 2, ..SaveOptions::default() }, SaveOptions { version: 1, pretty: true, ..SaveOptions::default() }] { let back = load(&save_with(&d, &o).unwrap()).unwrap(); - let want = if o.version < vectorcraft_format::VERSION { &older } else { &want }; + let want = if o.version < vectorcraft_format::LIVE_STAR_SINCE { &older } else { &want }; prop_assert!(json_approx_eq(&doc_json(&back), want, 1e-12), "{:?} differs", o); } } diff --git a/crates/metafile/Cargo.toml b/crates/metafile/Cargo.toml index 25a42ef3cb..e2fbd9b4bf 100644 --- a/crates/metafile/Cargo.toml +++ b/crates/metafile/Cargo.toml @@ -8,11 +8,6 @@ description = "VectorCraft metafiles: EMF, WMF and QuickDraw PICT export and EMF [lints] workspace = true -[features] -# The binary CGM reader (`import_cgm`). Off until the craft-metafile CGM reader (craft-libs#5410) -# merges and the workspace pins it; without it, `is_cgm` is false and `import_cgm` is refused. -cgm = [] - [dependencies] vectorcraft-geom = { workspace = true } vectorcraft-color = { workspace = true } diff --git a/crates/metafile/src/import.rs b/crates/metafile/src/import.rs index 298d47f5d7..33acb8402a 100644 --- a/crates/metafile/src/import.rs +++ b/crates/metafile/src/import.rs @@ -95,12 +95,9 @@ pub(crate) fn import_pict(bytes: &[u8]) -> Result { } /// The longer side of a CGM picture without a metric scale, points (8 inches). -#[cfg(feature = "cgm")] const CGM_SIDE: f64 = 576.0; /// Read the first picture of a binary CGM (ISO/IEC 8632-3) through `craft_metafile`. -/// `craft_metafile::parse_cgm` comes with craft-libs#5410, so this waits on the `cgm` feature. -#[cfg(feature = "cgm")] pub(crate) fn import_cgm(bytes: &[u8]) -> Result { let cgm = craft_metafile::parse_cgm(bytes, CGM_SIDE).map_err(|e| e.to_string())?; let n = cgm.notes; @@ -113,6 +110,11 @@ pub(crate) fn import_cgm(bytes: &[u8]) -> Result { (n.restricted_text, "restricted text was set at its character height without fitting it to its box"), (n.character_spacing, "character spacing was not applied"), (n.text_cut, "text past 16,384 characters in one string was cut"), + (n.fonts_cut, "fonts past the first 256 of the font list were not read: their text uses the default font"), + (n.append_attributes, "appended text that followed a change to the text's look was set as its text began"), + (n.text_alignment, "text with continuous alignment was aligned left or on its baseline"), + (n.marker_types, "markers of types other than dot, plus, asterisk, circle and cross were drawn as plus signs"), + (n.unsupported_char_set, "text in a character set other than ASCII, Latin-1, UTF-8 and UTF-16 was read as Latin-1"), ]; p.warnings.extend(notes.iter().filter(|(on, _)| *on).map(|(_, w)| (*w).to_string())); if n.damaged_elements > 0 { diff --git a/crates/metafile/src/lib.rs b/crates/metafile/src/lib.rs index 0e82883a56..24d311ba46 100644 --- a/crates/metafile/src/lib.rs +++ b/crates/metafile/src/lib.rs @@ -255,33 +255,17 @@ pub fn import_pict(bytes: &[u8]) -> Result { Ok(p) } -/// Do `bytes` start like a binary CGM: BEGIN METAFILE, then METAFILE VERSION? Always false -/// without the `cgm` feature (craft-libs#5410). +/// Do `bytes` start like a binary CGM: BEGIN METAFILE, then METAFILE VERSION? pub fn is_cgm(bytes: &[u8]) -> bool { - #[cfg(feature = "cgm")] - return craft_metafile::is_cgm(bytes); - #[cfg(not(feature = "cgm"))] - { - let _ = bytes; - false - } + craft_metafile::is_cgm(bytes) } /// Read the first picture of a binary Computer Graphics Metafile (CGM, ISO/IEC 8632-3) into a -/// document whose one artboard is the picture's VDC extent. Without the `cgm` feature -/// (craft-libs#5410), every file is refused. +/// document whose one artboard is the picture's VDC extent. pub fn import_cgm(bytes: &[u8]) -> Result { - #[cfg(feature = "cgm")] - { - let mut p = import::import_cgm(bytes)?; - p.document.limit_depth_noting(&mut p.warnings); - Ok(p) - } - #[cfg(not(feature = "cgm"))] - { - let _ = bytes; - Err("CGM files can't be read in this build".to_string()) - } + let mut p = import::import_cgm(bytes)?; + p.document.limit_depth_noting(&mut p.warnings); + Ok(p) } #[cfg(test)] diff --git a/crates/metafile/src/tests.rs b/crates/metafile/src/tests.rs index 7e96a700b4..3ddcc5a014 100644 --- a/crates/metafile/src/tests.rs +++ b/crates/metafile/src/tests.rs @@ -11,8 +11,6 @@ use vectorcraft_geom::{Affine, PathData, Point, Rect, shapes}; use crate::*; -// The CGM reader waits on craft-libs#5410 (the `cgm` feature). -#[cfg(feature = "cgm")] mod cgm; mod import; mod pict; diff --git a/crates/metafile/src/tests/cgm.rs b/crates/metafile/src/tests/cgm.rs index a9cbca18fc..2155d4382e 100644 --- a/crates/metafile/src/tests/cgm.rs +++ b/crates/metafile/src/tests/cgm.rs @@ -313,6 +313,17 @@ fn what_the_reader_left_out_or_set_differently_is_warned_about() { assert!(p.warnings.iter().any(|w| w == "character spacing was not applied"), "{:?}", p.warnings); assert!(p.warnings.iter().any(|w| w == "2 drawing elements cut short or describing no shape were left out"), "{:?}", p.warnings); assert_eq!(paths(&p.document).len(), 1); + + // Continuous horizontal alignment before a text, and a marker type past cross before a marker. + let bytes = cgm( + &[], + &[extent()], + &[el(5, 18, &be(&[4, 0, 0, 0, 0, 0])), el(4, 4, &[be(&[100, 100, 1]), s("x")].concat()), el(5, 6, &be(&[6])), el(4, 3, &be(&[100, 100]))], + ); + let p = import_cgm(&bytes).unwrap(); + assert!(p.warnings.iter().any(|w| w == "text with continuous alignment was aligned left or on its baseline"), "{:?}", p.warnings); + let markers = "markers of types other than dot, plus, asterisk, circle and cross were drawn as plus signs"; + assert!(p.warnings.iter().any(|w| w == markers), "{:?}", p.warnings); } #[test] diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 94c7319507..5650751445 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -168,7 +168,6 @@ impl VectorcraftApp { hover_object: None, grab: None, carry_target: None, - removed_press: false, last_drag: None, escaped_press: false, pressed_at: None, diff --git a/crates/ui-egui/src/caches.rs b/crates/ui-egui/src/caches.rs index 660b2814ef..a260b8d6b7 100644 --- a/crates/ui-egui/src/caches.rs +++ b/crates/ui-egui/src/caches.rs @@ -123,9 +123,6 @@ pub struct CanvasCache { /// The uid of the document a tab rest showed while art carried off the canvas waits over it: only its canvas takes /// the art, so a target closed or left by other means carries nothing (`canvas::drops`). pub carry_target: Option, - /// The tool host ended the tool's press with a `Removed` cancel in this pass: the canvas was hidden for a pass, as - /// when art carried off it rests on another document's tab and comes back (`tool_adapter::resume_carry`). - pub removed_press: bool, /// The last drag the tool was sent and the screen point it was at: when the view scrolls under the held /// pointer, the drag goes on at that point in the scrolled view. pub last_drag: Option<(egui::Pos2, vectorcraft_tools::PointerEvent)>, diff --git a/crates/ui-egui/src/canvas/selection.rs b/crates/ui-egui/src/canvas/selection.rs index d30921195d..5496faf6b5 100644 --- a/crates/ui-egui/src/canvas/selection.rs +++ b/crates/ui-egui/src/canvas/selection.rs @@ -682,6 +682,29 @@ struct MeshKey { pixels_per_point: f32, options: egui::epaint::TessellationOptions, look: MarkLook, + /// [`Joins`] of the paint, or none under a fade. + joins: Option, +} + +/// When a mark's fill and its edge are one shape, as `BezierOverlay`'s kept mesh joins them: the edge is opaque and +/// wider than `thin_line`, the widest stroke egui tessellates as a translucent ridge (0.9 of the feathering, in points). +/// Under a fade (a painter opacity below 1) the overlay keeps them two shapes, so the fill shows through the edge. +#[derive(Clone, Copy, Debug, PartialEq)] +struct Joins { + thin_line: f32, +} + +impl Joins { + /// The joins of a painter at `opacity` with `options` at `pixels_per_point`. + fn of(opacity: f32, options: &egui::epaint::TessellationOptions, pixels_per_point: f32) -> Option { + let thin_line = if options.feathering { 0.9 * (options.feathering_size_in_pixels * (1.0 / pixels_per_point)) } else { 0.0 }; + (opacity >= 1.0).then_some(Self { thin_line }) + } + + /// Whether a fill and then `edge` around the same square or circle are one shape. + fn join(joins: Option, edge: Stroke) -> bool { + joins.is_some_and(|joins| edge.color.is_opaque() && edge.width > joins.thin_line) + } } /// The anchor marks tessellated as one mesh, and what they were tessellated from. @@ -865,19 +888,21 @@ impl Component for AnchorMarks<'_> { reach: style.reach, }; let painter = ui.content_painter(cx); + let (pixels_per_point, options) = (painter.pixels_per_point(), painter.painter.ctx().tessellation_options(|options| *options)); let key = MeshKey { marks: self.key, view: space.view, rect: cx.rect, clip: painter.painter.clip_rect(), - pixels_per_point: painter.pixels_per_point(), - options: painter.painter.ctx().tessellation_options(|options| *options), + pixels_per_point, + options, look, + joins: Joins::of(painter.painter.opacity(), &options, pixels_per_point), }; let shapes = || { let mut shapes = Vec::new(); for set in mark_sets(self.anchors) { - mark_shapes(&mut shapes, &set, &space.view, cx.rect, &look); + mark_shapes(&mut shapes, &set, &space.view, cx.rect, &look, key.joins); } shapes }; @@ -955,8 +980,9 @@ fn mark_sides(options: &PathOptionsSettings, look: &MarkLook) -> [f32; 2] { } /// The egui shapes `BezierOverlay` paints for `set` under `BezierTool::Anchors`, in its order: every outline, the -/// selected segment, then the anchors and handles near `rect`, then the handles of the other paths' selected anchors. -fn mark_shapes(out: &mut Vec, set: &MarkSet<'_>, view: &CanvasView, rect: Rect, look: &MarkLook) { +/// selected segment, then the anchors and handles near `rect`, then the handles of the other paths' selected anchors +/// that reach near `rect`. An anchor's or a handle end's fill and edge are one shape under `joins`. +fn mark_shapes(out: &mut Vec, set: &MarkSet<'_>, view: &CanvasView, rect: Rect, look: &MarkLook, joins: Option) { let options = set.options; let option_color = options.color.map(|[r, g, b]| Color32::from(Srgba::rgb(f32::from(r) / 255.0, f32::from(g) / 255.0, f32::from(b) / 255.0))); let path_color = |path: &EditPath| path.color.map(Color32::from); @@ -1006,14 +1032,18 @@ fn mark_shapes(out: &mut Vec, set: &MarkSet<'_>, view: &CanvasView, rect: MarkFill::Path => color.unwrap_or(look.line), }; let edge = Stroke::new(look.thin, color.unwrap_or(look.edge)); - if circle { - let radius = side / 2.0; - out.push(Shape::Circle(egui::epaint::CircleShape { center: at, radius, fill, stroke: Stroke::NONE })); - out.push(Shape::Circle(egui::epaint::CircleShape { center: at, radius, fill: Color32::TRANSPARENT, stroke: edge })); + let shape = |fill: Color32, stroke: Stroke| { + if circle { + Shape::Circle(egui::epaint::CircleShape { center: at, radius: side / 2.0, fill, stroke }) + } else { + Shape::Rect(egui::epaint::RectShape::new(Rect::from_center_size(at, egui::Vec2::splat(side)), 0.0, fill, stroke, StrokeKind::Inside)) + } + }; + if Joins::join(joins, edge) { + out.push(shape(fill, edge)); } else { - let square = Rect::from_center_size(at, egui::Vec2::splat(side)); - out.push(Shape::Rect(egui::epaint::RectShape::new(square, 0.0, fill, Stroke::NONE, StrokeKind::Inside))); - out.push(Shape::Rect(egui::epaint::RectShape::new(square, 0.0, Color32::TRANSPARENT, edge, StrokeKind::Inside))); + out.push(shape(fill, Stroke::NONE)); + out.push(shape(Color32::TRANSPARENT, edge)); } }; // A direction handle: its line from the anchor, then its end. @@ -1046,7 +1076,10 @@ fn mark_shapes(out: &mut Vec, set: &MarkSet<'_>, view: &CanvasView, rect: if circles || set.handles == HandlesShown::All { return; } - // The handles of anchors selected in paths other than the edited one. + // The handles of anchors selected in paths other than the edited one whose end is near `rect`, or whose line from + // the anchor may cross it. Near is the reach, or the half side and edge of the largest handle end and one point for + // its feathered edge when that is further. + let near = rect.expand(look.reach.max(look.anchor.max(look.large) / 2.0 + look.thin + 1.0)); let edited = set.selection.path.map_or(0, |_| set.selection.anchors.len()); for path in set.paths { if set.selection.path == Some(path.key) || !selected.listed.contains(&path.key) { @@ -1055,7 +1088,10 @@ fn mark_shapes(out: &mut Vec, set: &MarkSet<'_>, view: &CanvasView, rect: let own = PathSelection::new(Some(path.key), Vec::new(), None); let listed = |key: u64, knot: KnotRef| selected.others.contains(&(key, knot)); for (_, knot, end) in handles_of(std::slice::from_ref(path), &own, listed, selected.others_len + edited, set.handles, view) { - handle(out, path, knot, end); + let reaches = near.contains(end) || path.knot(knot).is_some_and(|k| Rect::from_two_pos(view.to_screen(k.anchor), end).intersects(near)); + if reaches { + handle(out, path, knot, end); + } } } } diff --git a/crates/ui-egui/src/canvas/selection/tests.rs b/crates/ui-egui/src/canvas/selection/tests.rs index 1afaec46f3..875b9fe682 100644 --- a/crates/ui-egui/src/canvas/selection/tests.rs +++ b/crates/ui-egui/src/canvas/selection/tests.rs @@ -1132,6 +1132,16 @@ fn the_anchor_marks_paint_what_the_bezier_overlay_paints() { } }); app.session.active_mut().unwrap().selection.segments.clear(); + // Another path's selected anchors far off the canvas: their handles, ends and lines both off it, are left out. + let far = id_of(&app.run("path.create", json!({"d": "M-3000 -3000 C-2900 -3100 -2800 -3100 -2700 -3000"})).unwrap()); + app.run("select.anchors", json!({"id": curve.0, "anchors": [[0, 1]], "mode": "set"})).unwrap(); + app.run("select.anchors", json!({"id": far.0, "anchors": [[0, 0], [0, 1]], "mode": "add"})).unwrap(); + compare(&mut app, "handles of another path off the canvas", &|anchors| { + assert!( + anchors.selection.others.iter().any(|(key, knots)| !knots.is_empty() && anchors.paths.iter().any(|p| p.key == *key)), + "another path's anchors are selected" + ); + }); app.run("select.set", json!({"ids": [curve.0]})).unwrap(); app.select_tool("curvature"); compare(&mut app, "the Curvature tool", &same); @@ -1439,6 +1449,7 @@ fn kept_at_one_pixel_per_point() -> KeptMesh { pixels_per_point: 1.0, options: egui::epaint::TessellationOptions::default(), look, + joins: Joins::of(1.0, &egui::epaint::TessellationOptions::default(), 1.0), }, mesh: Arc::new(egui::Mesh::default()), moved: [0.0; 2], diff --git a/crates/ui-egui/src/canvas/tool_adapter.rs b/crates/ui-egui/src/canvas/tool_adapter.rs index 6e77eaf51a..0205c4416d 100644 --- a/crates/ui-egui/src/canvas/tool_adapter.rs +++ b/crates/ui-egui/src/canvas/tool_adapter.rs @@ -1,9 +1,7 @@ //! The document tool as the framework's `CanvasTool`: the pointer and key calls of the tool host go to the engine //! session, and what the session asks of the UI is applied here. -use std::any::Any; use std::cell::{Cell, RefCell, RefMut}; -use std::sync::Arc; use craft::behavior::{CancelReason, CanvasView, Cursor, PointerKind as Device, PressPhase}; use craft::keymap::{Chord, Key}; @@ -12,9 +10,6 @@ use craft::ui::canvas::{ Autoscroll, CanvasTool, Momentary, MomentaryShift, ToolAction, ToolClaims, ToolContext, ToolHost, ToolHostResponse, ToolKey, ToolPass, ToolPointer, }; -use craft::ui::contract::DragPreview; -use craft::ui::runtime::drag; -use craft::ui::runtime::env::Env; use serde_json::json; use vectorcraft_engine::ViewInfo; use vectorcraft_geom::Point; @@ -453,9 +448,6 @@ impl CanvasTool for SessionTool<'_> { fn cancel(&mut self, reason: CancelReason, cx: &mut ToolContext<'_>) { self.send_samples(); let mut app = self.app(); - if reason == CancelReason::Removed { - app.canvas.removed_press = true; - } if app.ui.screen_mode == 3 { // The tool had no press of Presentation Mode's. app.canvas.last_drag = None; @@ -712,8 +704,6 @@ pub(crate) fn run(app: &mut VectorcraftApp, ui: &mut Ui, pass: &ToolPass) -> Too app.canvas.keys_at = Some(ui.input(|i| i.time)); } let view_info = app.view_info(); - let carry = carried_session(ui.ctx()); - app.canvas.removed_press = false; let mut picked = ToolHostResponse::default(); let mut response = if crate::dialogs::recolor::edit_tab::with_theme_pick(app, |app, tool| picked = host_run(app, ui, pass, tool)) { picked @@ -747,7 +737,6 @@ pub(crate) fn run(app: &mut VectorcraftApp, ui: &mut Ui, pass: &ToolPass) -> Too drop(tool); response }; - resume_carry(app, ui, pass, carry); // The framework ends a press at Escape; the engine's tool still takes the release that ends it. if app.canvas.escaped_press && !ui.input(|i| i.pointer.primary_down()) { app.canvas.escaped_press = false; @@ -796,28 +785,6 @@ pub(crate) fn run(app: &mut VectorcraftApp, ui: &mut Ui, pass: &ToolPass) -> Too response } -/// The art a move carries off the canvas and what the panels see of it, while that drag session runs. -type Carry = (Arc, Arc); - -/// The drag session of art carried off the canvas, when one runs. -fn carried_session(ctx: &egui::Context) -> Option { - Some((drag::active::(ctx)?, drag::active::(ctx)?)) -} - -/// Starts the drag session `carry` again when the tool host ended it in this pass with the press's `Removed` cancel -/// while the button is still held. The canvas was hidden for a pass, as when the art rests on another document's tab -/// and comes back, and the release then drops the art where it lands. -// Workaround: storytold/craft-libs#5281 keeps the session running; remove this with the pin bump that takes it. -fn resume_carry(app: &mut VectorcraftApp, ui: &Ui, pass: &ToolPass, carry: Option) { - let removed = std::mem::take(&mut app.canvas.removed_press); - let Some((art, panel)) = carry else { return }; - if !removed || drag::active::(ui.ctx()).is_some() || !ui.input(|i| i.pointer.primary_down()) { - return; - } - let also: Arc = panel; - drag::start(ui.ctx(), pass.id, &Env::of(ui).view(), art, vec![also], DragPreview::None); -} - fn host_run_session(tool: &mut SessionTool<'_>, ui: &Ui, pass: &ToolPass) -> ToolHostResponse { let mut app = tool.app(); // The host borrows the tool and the app both through the cell, one call at a time. diff --git a/crates/ui-egui/src/dialogs/save_options.rs b/crates/ui-egui/src/dialogs/save_options.rs index 1d3cb996ee..c9813018b4 100644 --- a/crates/ui-egui/src/dialogs/save_options.rs +++ b/crates/ui-egui/src/dialogs/save_options.rs @@ -482,8 +482,9 @@ impl craft::behavior::ItemSource for Boards { } /// The native versions VectorCraft writes, newest first, each with the first release that reads -/// it (the format version each release tag writes: 2 in 0.1, 3 from 0.2, 4 from 0.8). -const NATIVE_VERSIONS: [(u32, &str); 4] = [(4, "0.8"), (3, "0.2"), (2, "0.1"), (1, "0.1")]; +/// it (the format version each release tag writes: 2 in 0.1, 3 from 0.2, 4 from 0.8, 5 from the +/// release after 0.25.2). +const NATIVE_VERSIONS: [(u32, &str); 5] = [(5, "0.25.3"), (4, "0.8"), (3, "0.2"), (2, "0.1"), (1, "0.1")]; /// The native version the dialog will write (the current one unless chosen). fn native_version_of(fields: &DialogFields) -> u32 { diff --git a/crates/ui-egui/src/panels/layers/tests.rs b/crates/ui-egui/src/panels/layers/tests.rs index 6aba351c34..62f56174de 100644 --- a/crates/ui-egui/src/panels/layers/tests.rs +++ b/crates/ui-egui/src/panels/layers/tests.rs @@ -1578,13 +1578,14 @@ fn layers_and_swatches(app: &mut VectorcraftApp, ui: &mut egui::Ui) { crate::panels::swatches::show(app, ui); } -/// The texture of the icon drawn inside `rect`. -fn icon_texture(shapes: &[egui::Shape], rect: egui::Rect) -> egui::TextureId { +/// The texture of the icon drawn inside `rect`, and the part of it the icon shows: icons share packed atlas pages. +fn icon_texture(shapes: &[egui::Shape], rect: egui::Rect) -> (egui::TextureId, egui::Rect) { shapes .iter() .find_map(|shape| match shape { egui::Shape::Mesh(mesh) if mesh.texture_id != egui::TextureId::default() && rect.contains_rect(mesh.calc_bounds()) => { - Some(mesh.texture_id) + let uv: Vec = mesh.vertices.iter().map(|v| v.uv).collect(); + Some((mesh.texture_id, egui::Rect::from_points(&uv))) } _ => None, }) diff --git a/docs/mcp.md b/docs/mcp.md index 4eb7f5f326..c3335ed63a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -880,8 +880,8 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions | `invoke_menu` | `{command, params?}` | Invokes a menu item by command id. UI commands such as `view.*` and `window.*` are in `command_list` with `ui: true`; running them needs the desktop app (`--connect`). The app refuses `attributes.openUrl`, `file.export.svg.browser`, `file.saveForWeb.browser` and `file.showPackage` for every control and MCP request, since each opens another app, so the headless error for them does not suggest `--connect`. | | `open_panel` | `{panel}` | Remote only. `panel` is a panel id (`layers`, `swatches`, `colorGuide`, …, as `window.panel` takes) or its display label (`"Color Guide"`), in any case. | | `screenshot` | `{path?, scale?, artboard?, window?, max_side?, traceViews?}` | Returns MCP image content (`image/png`, base64) plus a text block. Renders the artboard with the pixels of a PNG `export` with `background: "white"` at the same scale; `traceViews:true` draws Image Trace objects in the view set with `imageTrace.setView`, as in the app's window; `window:true` captures the app window (remote only), as `ui_screenshot` does, and `max_side` (1–4096, window captures only) scales the returned image down as described for `ui_screenshot`. With `path` the backend (the headless session or the app) writes the PNG there too; a window capture written there keeps its full size with `max_side`. An app that does not send the image back writes a window capture without `path` to a file in a new folder inside the system's temporary folder (on Unix only the user can open it); the server reads the file and then removes the folder, also when the capture or the read fails. | -| `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PICT (`.pct`/`.pic`/`.pict`, and a version 2 picture of any extension), HP-GL (`.plt`/`.hpgl`/`.hgl`/`.hpg`, and a file of an extension no other format reads that starts with plotter instructions), PNG (`.png`/`.pns`), JPEG (`.jpg`/`.jpeg`/`.jpe`), GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a PSD or PSB file with its layers as layers, or as its merged image through `run_command document.open` with `layers: false`; a JPEG XL file as its first frame), CDR drawings of versions 1 to 27 (`.cdr`, `.cdt`), CMX files with 32-bit coordinates (`.cmx`), layered raster `.pcraft` documents (as one image at the canvas size; a warning says when only the smaller preview could be read), DWG drawings (`.dwg`, `.dws`, `.dwt`). Templates (`.vctemplate`, `.ait`, `.cdt`, `.dwt`) open as a new untitled document. A text, RTF or Word file (`.txt`, `.rtf`, `.docx`, `.doc`) opens as a new letter-size document named after the file, its text area type 36 pt inside the artboard as `file.place` sets it; `run_command document.open` with `text` gives a `.txt` file's Text Import Options, and Save asks for a name. A `.txt` file without text, and an RTF file that ends inside a group, are refused and open nothing. A file with one of those extensions that starts with a PDF header or an Affinity signature opens as that format instead. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin."` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. | -| `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable; `.eps`: by default one file whose bounding box fits the visible art, the first artboard when no art shows; `options.useArtboards: true` makes the chosen artboard the page and, with two or more chosen, the file at the path is the central file of the visible art and each artboard is also written to `_.eps` beside it, listed in the reply's `files`). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 4) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error; versions 1 to 3 get each live star as a plain path of its outline, without its point count and ratio), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a PDF-compatible `.ai` file reads `compress` but not `version`, `preview`, `precision`, `outlineText`, `hiddenObjects`, `transparentImages` or `preserveEditing`, and a legacy `.ai` file reads only its own options). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for each key given beside the path or in `options` that the file doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). In the desktop app, a save that runs in the background shows in the progress window after 0.4 s with a moving bar. `file.cancelSave` stops every such save before it replaces its file → `{cancelled: n}`: the file stays as it was, and the document keeps its file and format and stays modified. A save whose file was already being replaced finishes and is reported as saved. `file.saveInBackground` closes the window while the saves go on → `{hidden: n}`. | +| `open_file` | `{path, importer?, params?}` | Opens any readable file as a new active document: `.vectorcraft`/`.drawcraft`, `.vctemplate`, `.svg`/`.svgz`, `.pdf`/`.ai`, `.ait`, `.eps`/`.epsf`, `.ps`, `.dxf`, `.emf`, `.wmf`, PICT (`.pct`/`.pic`/`.pict`, and a version 2 picture of any extension), binary CGM (`.cgm`, and a binary CGM of any extension), HP-GL (`.plt`/`.hpgl`/`.hgl`/`.hpg`, and a file of an extension no other format reads that starts with plotter instructions), PNG (`.png`/`.pns`), JPEG (`.jpg`/`.jpeg`/`.jpe`), GIF, WebP, TIFF, BMP (`.bmp`/`.dib`/`.rle`), Targa (`.tga`/`.vda`/`.icb`/`.vst`), PCX, Pixar (`.pxr`), JPEG 2000 (`.jpf`/`.jpx`/`.jp2`/`.j2k`/`.j2c`/`.jpc`), HEIC/HEIF (`.heic`/`.heif`), JPEG XL (`.jxl`), PSD (`.psd`/`.pdd`)/PSB (an image opens as a document of its pixel size; a PSD or PSB file with its layers as layers, or as its merged image through `run_command document.open` with `layers: false`; a JPEG XL file as its first frame), CDR drawings of versions 1 to 27 (`.cdr`, `.cdt`), CMX files with 32-bit coordinates (`.cmx`), layered raster `.pcraft` documents (as one image at the canvas size; a warning says when only the smaller preview could be read), DWG drawings (`.dwg`, `.dws`, `.dwt`). Templates (`.vctemplate`, `.ait`, `.cdt`, `.dwt`) open as a new untitled document. A text, RTF or Word file (`.txt`, `.rtf`, `.docx`, `.doc`) opens as a new letter-size document named after the file, its text area type 36 pt inside the artboard as `file.place` sets it; `run_command document.open` with `text` gives a `.txt` file's Text Import Options, and Save asks for a name. A `.txt` file without text, and an RTF file that ends inside a group, are refused and open nothing. A file with one of those extensions that starts with a PDF header or an Affinity signature opens as that format instead. PDF, `.ai` and SVG files saved with Preserve Editing reopen as the document they carry. The reply is `document.open`'s: its `warnings` say what didn't come in as it was (an EPS whose PostScript can't be read opens as its preview, and the warning names the PostScript error, the operator and the procedure). A file of an extension only an installed importer plug-in lists opens with that importer ([Plug-ins](#plug-ins)); `importer: "plugin."` opens the file with the importer it names, which must list the file's extension, also one a built-in format reads (in the app, as File › Open With does), and `params` gives that importer's parameters (their defaults when omitted). `run_command document.formats` lists the formats. | +| `save_file` | `{path?, compress?, version?, preview?, precision?, options?}` | Runs `document.save`: the document's own file in its own format (native `.vectorcraft` unless it was opened from or saved as SVG, PDF or a restorable `.ai`; then `warnings` say what that format loses). A path's extension picks the format (`.vectorcraft`, `.vctemplate`, `.pdf`, `.svg`, `.svgz`, `.ai`: a PDF carrying the native document, which reopens editable; `.eps`: by default one file whose bounding box fits the visible art, the first artboard when no art shows; `options.useArtboards: true` makes the chosen artboard the page and, with two or more chosen, the file at the path is the central file of the visible art and each artboard is also written to `_.eps` beside it, listed in the reply's `files`). For a native file, `compress: true` gzips it (default: the `useCompression` preference, Preferences › File Handling › Use Compression), `version` (1 to 5) writes it for an older VectorCraft (1 and 2 are never compressed, and `version: 2` with `compress: true` is an error; versions 1 to 4 get each live star as a plain path of its outline, without its point count and ratio, and versions 1 to 3 get placed documents as the art they show), `preview: true` embeds a PNG of the first artboard, and `precision` (0 to 9) rounds path anchors and handles to that many decimal places for that save only (colors, transforms and type stay exact). `options` passes the format's save options as `run_command document.formats` lists them. When `compress`, `version`, `preview` or `precision` is given both at the top level and in `options` with different values, the call is an error (`` `compress: true` and `options.compress: false` disagree: give the option once ``) and nothing is written. A key in `options` that no save format takes is an error, and nothing is written (see Parameter keys). The save drops each option the written format doesn't read. The reply's `warnings` then name each such option given (for example `` `compress` was not used: SVG files don't read it `` for an `.svg` path, and `` `options.preview` was not used: … `` for a key in `options`; a PDF-compatible `.ai` file reads `compress` but not `version`, `preview`, `precision`, `outlineText`, `hiddenObjects`, `transparentImages` or `preserveEditing`, and a legacy `.ai` file reads only its own options). For a `.ai` file, these warnings name the kind of `.ai` written: a legacy .ai (version 7) for `aiVersion: "7"`, a non-PDF-compatible .ai for `pdfCompatible: false`, and a PDF-compatible .ai otherwise, including a save that reuses the options the document was last saved with. `run_command document.save` and the other save commands refuse any option given beside the path and in `options` with different values, and give the same warnings for each key given beside the path or in `options` that the file doesn't read. The headless session and the app receive the same `app.save` params, and the app is also sent `wait: true`: the call returns once the file is written, or with the error (such as a path outside the write root), even with Background Save on. When the save asks first (the question before replacing a file that opened with losses, or on macOS and Linux the file dialog for an untitled document without `path`), the reply is `{pending}` or `"cancelled"` as before, and the save that runs after the answer uses the Background Save preference. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). In the desktop app, a save that runs in the background shows in the progress window after 0.4 s with a moving bar. `file.cancelSave` stops every such save before it replaces its file → `{cancelled: n}`: the file stays as it was, and the document keeps its file and format and stays modified. A save whose file was already being replaced finishes and is reported as saved. `file.saveInBackground` closes the window while the saves go on → `{hidden: n}`. | | `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `pict` (a QuickDraw `.pct` picture), `hpgl` (a `.plt` plot file for plotters and cutters), `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF, WMF, PICT and HP-GL write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | @@ -13045,7 +13045,8 @@ error that says to save as DXF. `.dws` drawing standards files and `.dwt` templa `dws` or `dwt` answers with a hint to export DWG or DXF. Web builds and FreeBSD on 64-bit ARM have no DWG decoder: there `document.formats` lists `dwg` and `dwt` as not readable, File › Open, File › Place and `openExtensions` list `.dwg`, `.dws` and `.dwt` only for an installed importer plug-in that reads them, and a DWG drawing opens or places only -through such a plug-in. PICT files open and place (see PICT import), and PICT export writes them. +through such a plug-in. PICT files open and place (see PICT import), and PICT export writes them. CGM files open and +place (see CGM import) but can't be written. ```json {"name":"run_command","arguments":{"command":"document.exportDxf","params":{"path":"/tmp/plan.dxf","version":"2013","unit":"mm","scale":10,"preserve":"editability"}}} @@ -13731,6 +13732,32 @@ the frame within 16-bit coordinates. The writer follows the opcodes and data lay {"name":"run_command","arguments":{"command":"document.export","params":{"format":"pict","useArtboards":true,"path":"/tmp/icons.pct"}}} ``` +## CGM import + +`document.open` and `file.place` read the first picture of a binary Computer Graphics Metafile (ISO/IEC 8632-3, +`.cgm`) into one artboard, the picture's VDC extent, and one layer. A binary CGM also opens by its content under any +name. A picture with a metric scale keeps its size; one without it is scaled so that its longer side is 576 pt +(8 inches). The extent's first corner is the picture's bottom left, so an extent that starts at the top left turns the +picture over. + +- Lines, polylines, rectangles, polygons and polygon sets, circles, ellipses and their arcs become paths, in the order + the picture draws them, with their line width, color, type, caps and joins. Filled shapes are outlined only while + edges are visible, and a polygon set leaves out its hidden edges. A figure fills its lines as one shape. +- Text becomes point type at its character height. Markers are drawn at their points. +- Cell arrays, packed or run-length encoded, become images. +- The clip rectangle clips what follows it. + +`file.place` places the picture as one group clipped to its frame. What isn't read as the file describes it comes back +in `warnings`, once each: hatch, pattern and interpolated fills (filled with their fill color), more than one picture, +colors in a CIE color model (read as RGB), text set to run left, up or down, restricted text, character spacing, text +past 16,384 characters in one string, fonts past the first 256 of the font list, appended text after a change to the +text's look, continuous text alignment, marker types other than dot, plus, asterisk, circle and cross (drawn as plus +signs), text in a character set other than ASCII, Latin-1, UTF-8 and UTF-16 (read as Latin-1), and drawing elements cut +short or describing no shape. A picture cut short keeps what came before it with a warning. A file that is not a CGM is +refused with "not a CGM file", a clear-text CGM with a message that only binary CGM files are read, and a metafile +without a picture with "the CGM file holds no picture". CGM can't be written: `document.export` to it is refused with +"CGM files can be opened but not written". + ## HP-GL import `document.open` and `file.place` read HP-GL/2 plot files (`.plt`, `.hpgl`, `.hgl`, `.hpg`) into one layer, with the diff --git a/xtask/src/pdf_deps.rs b/xtask/src/pdf_deps.rs index 839f55b257..1099a3cf07 100644 --- a/xtask/src/pdf_deps.rs +++ b/xtask/src/pdf_deps.rs @@ -5,7 +5,7 @@ use std::process::Command; use serde_json::Value; -const REV: &str = "138ce9929ea48d055c797f61c042a3c407427d97"; +const REV: &str = "6b67abe4b3deead5a1437dc6987a85b35afd40f6"; const PACKAGES: &[(&str, &str, &str)] = &[ ("craft-pdf", "0.1.0", REV), ("krilla", "0.8.2", REV),