diff --git a/Cargo.lock b/Cargo.lock index fdf9aaaf6..6d54792fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1091,12 +1091,12 @@ dependencies = [ [[package]] name = "craft-cfb" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "md-5", "rayon", @@ -1105,7 +1105,7 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" [[package]] name = "craft-csv" @@ -1159,16 +1159,16 @@ dependencies = [ [[package]] name = "craft-docx" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ "base64 0.23.1", "chrono", - "craft-drawingml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-drawingml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "craft-math", "craft-offcrypto", - "craft-opc 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-opc 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "craft-wordmodel", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "log", "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1190,9 +1190,9 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "kurbo", "log", "serde", @@ -1278,10 +1278,10 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1ad5f35bf#1ad5f35bf0b33f5846fd8aec782f0ba5a9e3b596" +source = "git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2#899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", "thiserror 2.0.21", ] @@ -1298,9 +1298,10 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f#cc23ffd4d26f3074808e2187d332564817624f8f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ - "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", "exr", "flate2", "half", @@ -1320,10 +1321,32 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6#ea1c84290dadec636900b4d1bce107e59ca3f0d6" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" dependencies = [ - "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", - "craft-metadata", + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", + "craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", + "exr", + "flate2", + "half", + "image", + "image-webp", + "jpeg-encoder", + "png", + "rayon", + "serde_json", + "thiserror 2.0.21", + "tiff", + "zune-core", + "zune-jpeg", + "zune-jpegxl", +] + +[[package]] +name = "craft-image-codecs" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f#cc23ffd4d26f3074808e2187d332564817624f8f" +dependencies = [ + "craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", "exr", "flate2", "half", @@ -1373,7 +1396,7 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f#cc23ffd4d26f3074808e2187d332564817624f8f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "thiserror 2.0.21", ] @@ -1381,7 +1404,15 @@ dependencies = [ [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6#ea1c84290dadec636900b4d1bce107e59ca3f0d6" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "craft-jpeg" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f#cc23ffd4d26f3074808e2187d332564817624f8f" dependencies = [ "thiserror 2.0.21", ] @@ -1409,20 +1440,32 @@ dependencies = [ [[package]] name = "craft-math" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "serde", ] [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6#ea1c84290dadec636900b4d1bce107e59ca3f0d6" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "brotli-decompressor 6.3.1", "chrono", - "craft-tiff", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", + "quick-xml 0.41.0", + "serde", +] + +[[package]] +name = "craft-metadata" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" +dependencies = [ + "brotli-decompressor 6.3.1", + "chrono", + "craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "quick-xml 0.41.0", "serde", ] @@ -1430,12 +1473,12 @@ dependencies = [ [[package]] name = "craft-offcrypto" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ "aes", "base64 0.23.1", "craft-cfb", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "getrandom 0.3.4", "hmac", "sha1 0.11.0", @@ -1458,10 +1501,10 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484)", "log", "thiserror 2.0.21", ] @@ -1469,10 +1512,10 @@ dependencies = [ [[package]] name = "craft-opc" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551#8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551)", "log", "thiserror 2.0.21", ] @@ -1491,10 +1534,10 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "bytemuck", - "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f)", + "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", "hayro", "hayro-interpret", "hayro-syntax", @@ -1522,7 +1565,7 @@ dependencies = [ [[package]] name = "craft-prepress" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "craft-cms", "craft-pdf", @@ -1548,7 +1591,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6#ea1c84290dadec636900b4d1bce107e59ca3f0d6" +source = "git+https://github.com/storytold/craft-libs?rev=d15bf1f35b17b759870f9e5111b9a5d243f64888#d15bf1f35b17b759870f9e5111b9a5d243f64888" dependencies = [ "encoding_rs", "flate2", @@ -1559,7 +1602,7 @@ dependencies = [ [[package]] name = "craft-rtf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" dependencies = [ "craft-codepage", "encoding_rs", @@ -1573,14 +1616,17 @@ source = "git+https://github.com/storytold/craft-libs?rev=2b9a325f57624804ed423a [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", "flate2", "kurbo", "roxmltree 0.21.2", "thiserror 2.0.21", "usvg 0.48.1", + "vectorcraft-geom", + "vectorcraft-pathops", ] [[package]] @@ -1614,7 +1660,16 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6#ea1c84290dadec636900b4d1bce107e59ca3f0d6" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" +dependencies = [ + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-tiff" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701#bfea7d9800a9f14e496209f9df30e9ef45655701" dependencies = [ "serde", "thiserror 2.0.21", @@ -1690,7 +1745,7 @@ dependencies = [ [[package]] name = "craft-wordmodel" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf#6d0b33c0cd63ae4250c180a04eb4a4d66ab81448" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" dependencies = [ "base64 0.23.1", "craft-math", @@ -1713,15 +1768,6 @@ dependencies = [ "thiserror 2.0.21", ] -[[package]] -name = "craft-xml" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1ad5f35bf#1ad5f35bf0b33f5846fd8aec782f0ba5a9e3b596" -dependencies = [ - "quick-xml 0.41.0", - "thiserror 2.0.21", -] - [[package]] name = "craft-xml" version = "0.1.0" @@ -1734,7 +1780,17 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2#899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1749,6 +1805,16 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-xml" version = "0.1.0" @@ -1776,16 +1842,6 @@ dependencies = [ "thiserror 2.0.21", ] -[[package]] -name = "craft-xml" -version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1#f23b0f33f0d00b157476533a43cbbcfd901aa1f1" -dependencies = [ - "quick-xml 0.41.0", - "serde", - "thiserror 2.0.21", -] - [[package]] name = "craft-xml" version = "0.1.0" @@ -1798,7 +1854,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1ad5f35bf#1ad5f35bf0b33f5846fd8aec782f0ba5a9e3b596" +source = "git+https://github.com/storytold/craft-libs?rev=2b9a325f57624804ed423aded16695eddb815119#2b9a325f57624804ed423aded16695eddb815119" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1808,7 +1864,17 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=2b9a325f57624804ed423aded16695eddb815119#2b9a325f57624804ed423aded16695eddb815119" +source = "git+https://github.com/storytold/craft-libs?rev=7ad4765ee55496d0ccdb7659ad7a6375c7bbb484#7ad4765ee55496d0ccdb7659ad7a6375c7bbb484" +dependencies = [ + "flate2", + "thiserror 2.0.21", + "zip 9.1.1", +] + +[[package]] +name = "craft-zip" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2#899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2037,7 +2103,7 @@ name = "designcraft-cli" version = "0.21.0" dependencies = [ "craft-file-formats", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2109,8 +2175,8 @@ dependencies = [ "craft-prepress", "craft-print", "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2192,9 +2258,9 @@ name = "designcraft-idml" version = "0.21.0" dependencies = [ "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2212,7 +2278,7 @@ dependencies = [ "craft-cms", "craft-eps 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ba24fe2435adb3c81ad6057faf36365fbba736cf)", "craft-file-formats", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "craft-psd", "craft-svg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=cc23ffd4d26f3074808e2187d332564817624f8f)", "designcraft-color", @@ -2246,7 +2312,7 @@ version = "0.21.0" dependencies = [ "chrono", "craft-cms", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "craft-pdf", "craft-prepress", "designcraft-color", @@ -2271,7 +2337,7 @@ name = "designcraft-pptx" version = "0.21.0" dependencies = [ "chrono", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "craft-opc 0.1.0 (git+https://github.com/storytold/craft-libs?rev=8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551)", "craft-pptx", "designcraft-color", @@ -2292,7 +2358,7 @@ name = "designcraft-render" version = "0.21.0" dependencies = [ "bytemuck", - "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ea1c84290dadec636900b4d1bce107e59ca3f0d6)", + "craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=bfea7d9800a9f14e496209f9df30e9ef45655701)", "craft-pdf", "designcraft-color", "designcraft-compose", @@ -2314,7 +2380,7 @@ version = "0.21.0" dependencies = [ "craft-docx", "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=1ad5f35bf)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2)", "craft-rtf", "craft-wordmodel", "craft-xlsx", @@ -3457,7 +3523,7 @@ dependencies = [ [[package]] name = "hayro" version = "0.7.1" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "bytemuck", "hayro-interpret", @@ -3477,7 +3543,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a" [[package]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "brotli", "hayro-postscript", @@ -3486,7 +3552,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -3504,7 +3570,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -3522,12 +3588,12 @@ dependencies = [ [[package]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "flate2", "hayro-ccitt", @@ -4168,7 +4234,7 @@ dependencies = [ [[package]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" +source = "git+https://github.com/storytold/craft-libs?rev=a5ac3aa05cf3ec013961a85599ddd9e0b5c03813#a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" dependencies = [ "base64 0.22.1", "bumpalo", @@ -7511,6 +7577,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "vectorcraft-geom" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "serde", + "thiserror 2.0.21", +] + +[[package]] +name = "vectorcraft-pathops" +version = "0.18.0" +source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e" +dependencies = [ + "kurbo", + "linesweeper", + "thiserror 2.0.21", + "vectorcraft-geom", +] + [[package]] name = "vello_common" version = "0.0.8" diff --git a/Cargo.toml b/Cargo.toml index 64d53fdc8..359bc7641 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,29 +12,29 @@ repository = "https://github.com/storytold/designcraft" [workspace.dependencies] # Shared reader and writer; publish the immutable revision before this consumer. -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.1.0", default-features = false } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.1.0", default-features = false } craft-designcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "b1b4602a71d19e09ad33f7752a10d6598cf39b2b", version = "=0.1.0" } craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } craft-epub = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } -craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "1ad5f35bf", version = "=0.1.0" } +craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2", version = "=0.1.0" } craft-indd = { git = "https://github.com/storytold/craft-libs", rev = "47bf5650b0d503b97bfb5e841746c4957897d11f", version = "=0.1.0" } craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "cc23ffd4d26f3074808e2187d332564817624f8f", version = "=0.1.0", features = ["tree-render", "tree-text"] } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "1ad5f35bf", version = "=0.1.0" } -craft-xml-dtd = { package = "craft-xml", git = "https://github.com/storytold/craft-libs", rev = "f23b0f33f0d00b157476533a43cbbcfd901aa1f1", version = "=0.1.0" } -craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "899e396b9e2710fcdf1ad9b6249d6c456b7ca9a2", version = "=0.1.0" } +craft-xml-dtd = { package = "craft-xml", git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.1.0" } +craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "bfea7d9800a9f14e496209f9df30e9ef45655701", version = "=0.1.0" } craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "2b9a325f57624804ed423aded16695eddb815119", version = "=0.1.0" } -craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } -craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } +craft-docx = { git = "https://github.com/storytold/craft-libs", rev = "7ad4765ee55496d0ccdb7659ad7a6375c7bbb484", version = "=0.1.0" } +craft-wordmodel = { git = "https://github.com/storytold/craft-libs", rev = "7ad4765ee55496d0ccdb7659ad7a6375c7bbb484", version = "=0.1.0" } craft-csv = { git = "https://github.com/storytold/craft-libs", rev = "387c64892b30fdad491b263cc3d9eac660d88dcc", version = "=0.1.0" } -craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "ea1c84290dadec636900b4d1bce107e59ca3f0d6", version = "=0.1.0" } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "ea1c84290dadec636900b4d1bce107e59ca3f0d6", version = "=0.1.0" } +craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "bfea7d9800a9f14e496209f9df30e9ef45655701", version = "=0.1.0" } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "d15bf1f35b17b759870f9e5111b9a5d243f64888", version = "=0.1.0" } craft-file-formats = { git = "https://github.com/storytold/craft-libs", rev = "eed3c28cf016723d004d6f2c79c61424c15d4558", version = "=0.1.0" } craft-opc = { git = "https://github.com/storytold/craft-libs", rev = "8abfa9d0f14bafbfc3449fc552ffeafb9ca6a551", version = "=0.1.0" } craft-pptx = { git = "https://github.com/storytold/craft-libs", rev = "f6cab1980", version = "=0.1.0" } # Shared keyboard bindings: chords, overrides, conflicts, egui dispatch, the Keyboard Shortcuts dialog. craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", version = "=0.1.0", features = ["egui", "ui"] } # Separations, ink coverage and the ink manager; same revision as craft-pdf and the krilla patch. -craft-prepress = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.1.0", features = ["flatten"] } +craft-prepress = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.1.0", features = ["flatten"] } # craft-update: app-specific pretend versions apply to startup and manual checks. craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", features = ["egui"] } # internal @@ -101,7 +101,7 @@ craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-li craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" } # ICC colour management: working spaces, transforms, black point compensation (craft-libs). -craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f" } +craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813" } # ui # Shared frontend components; keep this dependency above the engine boundary. @@ -151,16 +151,16 @@ debug = 0 # Opt-in cancelable macOS termination on the pinned winit 0.30 line. [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.8.2" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.8.2" } winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" } # The hayro crates from craft-libs' vendor/ directory (pdfcraft's, plus the plate mode and decode # limits craft-pdf and craft-prepress need); same revision as craft-pdf. -hayro = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.7.1" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.7.0" } -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.7.2" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.3.0" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.1.0" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "40525913633942f84b06d4837a8d90534a55d63f", version = "=0.1.0" } +hayro = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.7.1" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.7.0" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.7.2" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.3.0" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.1.0" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a5ac3aa05cf3ec013961a85599ddd9e0b5c03813", version = "=0.1.0" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" } diff --git a/ROADMAP.md b/ROADMAP.md index 50b299e8f..67fdbcf18 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -395,6 +395,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m ## Progress log +- **2026-11-15** · Format follow-ups to the craft-libs cutover (craft-libs#778; ported from #2734 by Dylan M. Taylor): IDML export keeps CDATA image contents and table spans such as `inf` reach the table edge; DOCX plain-text import leaves out deleted tracked changes and expands inline objects; an XLSX number cell that isn't a number shows as written; unmarked CMYK JPEGs keep the shared decoder's ink polarity; PPTX export writes exact opacity; PDF export repins craft-pdf and craft-prepress to craft-libs main. No readiness percentage change. - **2026-11-14** · `object.stroke` refuses a tint or gap tint outside 0 to 1, a weight outside 0 to 1000 pt, a miter limit outside 1 to 500, a gap overprint that isn't true or false, and an alignment, cap, join or arrowhead name it doesn't have, instead of clamping the numbers and skipping the names. The Stroke panel's Weight and Miter Limit fields keep their values in those ranges. No readiness percentage change. - **2026-11-14** · Photo books no longer freeze the canvas (#1411; based on #2051 by texjer). The image cache keeps only the mip level each image is drawn at, for every format and display quality: a TIFF, PNG, PSD or CMYK JPEG used to keep its full decode too (48 MB for a 12 MP photo), so after about a dozen photos each edit evicted and decoded them again on the render thread. The canvas no longer waits for decodes: an image not cached at its size shows a light box or another cached level and decodes on one of three background threads (within the same in-flight memory limit as the decodes ahead of a render), and finished decodes are drawn in batches, at most one canvas render every 250 ms. Zooming into an image decodes it at most twice. Thumbnails and exports still wait for every image. No readiness percentage change. - **2026-11-14** · IDML export keeps each endnote reference as its number in superscript text, as the endnote frame lists it, instead of dropping it; the endnotes are still written as plain text, without IDML's endnote elements (#2753). No readiness percentage change. diff --git a/crates/idml/src/export/common.rs b/crates/idml/src/export/common.rs index 734a16cc7..b20994a7a 100644 --- a/crates/idml/src/export/common.rs +++ b/crates/idml/src/export/common.rs @@ -10,7 +10,7 @@ pub(super) fn p(name: &str, ty: &str, val: impl Into) -> El { /// Insert a `` element as the first child when there are any. pub(super) fn with_props(el: El, props: Vec) -> El { - crate::xml::from_craft(craft_idml::with_props(crate::xml::to_craft(&el), props.into_iter().map(|p| crate::xml::to_craft(&p)).collect())) + crate::xml::from_craft_for_write(craft_idml::with_props(crate::xml::to_craft(&el), props.into_iter().map(|p| crate::xml::to_craft(&p)).collect())) } pub(super) fn pkg_root(kind: &str) -> El { diff --git a/crates/idml/src/import/table.rs b/crates/idml/src/import/table.rs index f36670be1..713576903 100644 --- a/crates/idml/src/import/table.rs +++ b/crates/idml/src/import/table.rs @@ -160,15 +160,11 @@ impl<'r> Importer<'r> { if r >= nr || c >= nc { continue; } - let (mut cs, mut rs) = model_cell.span(); - if model_cell.values.get("RowSpan").is_some_and(|v| v.eq_ignore_ascii_case("inf") || v.eq_ignore_ascii_case("infinity")) { - rs = (nr - r) as u32; - } - if model_cell.values.get("ColumnSpan").is_some_and(|v| v.eq_ignore_ascii_case("inf") || v.eq_ignore_ascii_case("infinity")) { - cs = (nc - c) as u32; - } - let rs = (rs as usize).min(nr - r); - let cs = (cs as usize).min(nc - c); + // Preserve the prior importer behavior for malformed positive spans such as `inf`: + // saturate the float-to-integer conversion, then clamp before grid arithmetic. + let span = |key| model_cell.values.prop(key).and_then(|v| v.trim().parse::().ok()).unwrap_or(1.0).max(1.0) as usize; + let rs = span("RowSpan").min(nr - r); + let cs = span("ColumnSpan").min(nc - c); let mut cell = t.cell(r, c).cloned().unwrap_or_default(); let cell_el = crate::xml::from_craft(model_cell.to_el()); let cell_style = diff --git a/crates/idml/src/xml.rs b/crates/idml/src/xml.rs index d09df0400..1dacb0fa9 100644 --- a/crates/idml/src/xml.rs +++ b/crates/idml/src/xml.rs @@ -227,6 +227,16 @@ pub fn parse(bytes: &[u8]) -> Result { } pub(crate) fn from_craft(el: craft_xml::El) -> El { + from_craft_with_cdata(el, false) +} + +/// Convert shared XML trees back into the writer's tree without losing CDATA boundaries. +/// Parsing deliberately folds CDATA into text, but write-side model composition must retain it. +pub(crate) fn from_craft_for_write(el: craft_xml::El) -> El { + from_craft_with_cdata(el, true) +} + +fn from_craft_with_cdata(el: craft_xml::El, preserve_cdata: bool) -> El { El { name: el.name, attrs: el.attrs, @@ -234,11 +244,10 @@ pub(crate) fn from_craft(el: craft_xml::El) -> El { .children .into_iter() .filter_map(|n| match n { - craft_xml::Node::El(e) => Some(Node::El(from_craft(e))), + craft_xml::Node::El(e) => Some(Node::El(from_craft_with_cdata(e, preserve_cdata))), craft_xml::Node::Text(t) => Some(Node::Text(t)), - // The parser joins CDATA to the text around it, so only trees built for export - // (`` image data passed through `with_props`) carry sections here. - craft_xml::Node::CData(t) => Some(Node::CData(t)), + craft_xml::Node::CData(t) if preserve_cdata => Some(Node::CData(t)), + craft_xml::Node::CData(t) => Some(Node::Text(t)), craft_xml::Node::Pi { target, data } => Some(Node::Pi(target, data.trim().to_string())), craft_xml::Node::Comment(_) => None, }) @@ -250,6 +259,16 @@ pub(crate) fn from_craft(el: craft_xml::El) -> El { mod tests { use super::*; + #[test] + fn parsed_cdata_is_text_but_write_conversion_preserves_its_boundary() { + let tree = craft_xml::El { name: "Contents".into(), attrs: Vec::new(), children: vec![craft_xml::Node::CData("JVBERi0=".into())] }; + assert_eq!(from_craft(tree.clone()).children, vec![Node::Text("JVBERi0=".into())]); + + let written = from_craft_for_write(tree); + assert_eq!(written.children, vec![Node::CData("JVBERi0=".into())]); + assert!(String::from_utf8(document(&written)).unwrap().contains("")); + } + /// Issue #712: nesting past the budget is an error from the parser, not a stack overflow later. #[test] fn nesting_past_the_budget_is_refused() { diff --git a/crates/images/src/lib.rs b/crates/images/src/lib.rs index 1017a34d8..6cf733ce4 100644 --- a/crates/images/src/lib.rs +++ b/crates/images/src/lib.rs @@ -402,7 +402,7 @@ pub fn decode_rgba(bytes: &[u8]) -> Option { } let decoded = craft_image_codecs::decode_with(bytes, &decode_options()).ok()?; if decoded.layout().is_cmyk() { - let raster = cmyk_raster(&decoded, bytes)?; + let raster = cmyk_raster(&decoded)?; return to_display_rgba(Pixels::Cmyk(raster), decoded.icc.as_deref(), &DisplayColour::active()); } let rgba = image::RgbaImage::from_raw(decoded.width(), decoded.height(), decoded.to_rgba8())?; @@ -479,39 +479,20 @@ fn decode_options() -> craft_image_codecs::DecodeOptions { craft_image_codecs::DecodeOptions { limits: craft_image_codecs::Limits { max_alloc: MAX_RGBA_BYTES, ..Default::default() }, ..Default::default() } } -/// Whether an APP14 "Adobe" segment comes before the image data. -fn adobe_marker(bytes: &[u8]) -> bool { - let mut i = 2; - while let Some(&[0xFF, marker, hi, lo]) = bytes.get(i..i + 4).and_then(|s| <&[u8; 4]>::try_from(s).ok()) { - // Start of scan or end of image: no more header segments. - if marker == 0xDA || marker == 0xD9 { - return false; - } - let len = usize::from(u16::from_be_bytes([hi, lo])); - if marker == 0xEE && bytes.get(i + 4..i + 9) == Some(b"Adobe".as_slice()) { - return true; - } - i += 2 + len; - } - false -} - -fn cmyk_raster(image: &craft_image_codecs::Image, bytes: &[u8]) -> Option { +/// Convert the shared decoder's CMYK values to the app's ink raster without changing their +/// polarity. `craft-image-codecs` already interprets Adobe-marked and unmarked JPEG CMYK and +/// YCCK samples; inverting unmarked JPEGs here reverses their documented device-ink values. +fn cmyk_raster(image: &craft_image_codecs::Image) -> Option { let converted = image.convert(craft_image_codecs::ChannelLayout::CmykA, craft_image_codecs::SampleType::U8); let pixels = usize::try_from(converted.width()).ok()?.checked_mul(usize::try_from(converted.height()).ok()?)?; let data = converted.as_u8()?; if data.len() != pixels.checked_mul(5)? { return None; } - let invert = bytes.starts_with(&[0xFF, 0xD8]) && !adobe_marker(bytes); let mut cmyk = Vec::with_capacity(pixels.checked_mul(4)?); let mut alpha = Vec::with_capacity(pixels); for &[c, m, y, k, a] in data.as_chunks::<5>().0 { - if invert { - cmyk.extend([255 - c, 255 - m, 255 - y, 255 - k]); - } else { - cmyk.extend([c, m, y, k]); - } + cmyk.extend([c, m, y, k]); alpha.push(a); } let alpha = alpha.iter().any(|&a| a < 255).then_some(alpha); @@ -609,7 +590,7 @@ pub fn decode_cmyk_tiff(bytes: &[u8]) -> Option { return None; } let image = craft_image_codecs::decode_with(bytes, &decode_options()).ok()?; - image.layout().is_cmyk().then(|| cmyk_raster(&image, bytes)).flatten() + image.layout().is_cmyk().then(|| cmyk_raster(&image)).flatten() } /// An SVG rasterised so its longer side is `max_side` pixels: premultiplied RGBA8. diff --git a/crates/pdf/src/export/images.rs b/crates/pdf/src/export/images.rs index 1c10452dd..96bce7fe0 100644 --- a/crates/pdf/src/export/images.rs +++ b/crates/pdf/src/export/images.rs @@ -17,7 +17,8 @@ pub(super) struct ConvertedImage { pub(super) warning: Option<&'static str>, } -pub(super) const CMYK_FALLBACK_WARNING: &str = "converted to RGB (a CMYK TIFF that uses other inks or is over 256 MiB)"; +pub(super) const CMYK_FALLBACK_WARNING: &str = + "converted to RGB (a CMYK TIFF that is planar, has premultiplied alpha, uses other inks or is over 256 MiB)"; #[cfg(not(test))] pub(super) type ImageContentCache = HashMap>, ConvertedImage>; diff --git a/crates/pdf/tests/support/image_content_cache_contract.rs b/crates/pdf/tests/support/image_content_cache_contract.rs index 74431e039..54a8c7e73 100644 --- a/crates/pdf/tests/support/image_content_cache_contract.rs +++ b/crates/pdf/tests/support/image_content_cache_contract.rs @@ -240,7 +240,7 @@ fn successful_fallback_warns_for_both_names_and_preserves_rgb_samples() { for (name, x) in [("other-inks-a.tif", 36.0), ("other-inks-b.tif", 66.0)] { place_named(&mut d, bytes.clone(), x, name, "image/tiff", 0); } - let reason = "converted to RGB (a CMYK TIFF that uses other inks or is over 256 MiB)"; + let reason = "converted to RGB (a CMYK TIFF that is planar, has premultiplied alpha, uses other inks or is over 256 MiB)"; let expected_warnings = [format!("other-inks-a.tif: {reason}"), format!("other-inks-b.tif: {reason}")]; // The fallback is the RGB the screen shows: converted through the working CMYK space. let rgb: Vec = designcraft_images::decode_rgba(&bytes).unwrap().pixels().flat_map(|p| [p[0], p[1], p[2]]).collect(); diff --git a/crates/pptx/src/slide.rs b/crates/pptx/src/slide.rs index 86ce61134..fd2d7ad62 100644 --- a/crates/pptx/src/slide.rs +++ b/crates/pptx/src/slide.rs @@ -13,6 +13,14 @@ use crate::fonts::Fonts; use crate::model::{Media, Slide}; use crate::{PptxError, PptxOptions, Result}; +/// Preserve fractional DesignCraft opacity in DrawingML instead of rounding it through 8-bit alpha. +pub(crate) fn color_with_opacity(color: designcraft_color::Color, opacity: f32) -> craft_pptx::ColorRef { + let [r, g, b, _] = color.to_rgba8(1.0); + let color = craft_pptx::ColorRef::rgb(craft_pptx::Rgba::rgb(r, g, b)); + let alpha = (f64::from(opacity.clamp(0.0, 1.0)) * 100_000.0).round() as i32; + if alpha == 100_000 { color } else { color.with(craft_pptx::ColorTransform::Alpha(alpha)) } +} + /// Objects PowerPoint can't show as editable objects, which a caller should rasterise before /// exporting: placed PDF and EPS graphics, type on a path, and effects without a DrawingML /// counterpart. @@ -362,20 +370,9 @@ impl<'a> Exporter<'a> { pub(crate) fn model_color(&self, swatch: &str, tint: f32, alpha: f32) -> Option { if let Some(gradient) = resolve_gradient(&self.doc.swatches, swatch) { let (_, color, gradient_alpha) = gradient.expanded_stops().into_iter().next()?; - let total_alpha = gradient_alpha * alpha; - let [r, g, b, _] = color.to_rgba8(1.0); - let mut c = craft_pptx::ColorRef::rgb(craft_pptx::Rgba::rgb(r, g, b)); - if total_alpha < 1.0 { - c = c.with(craft_pptx::ColorTransform::Alpha((total_alpha * 100_000.0).round() as i32)); - } - return Some(c); + return Some(color_with_opacity(color, gradient_alpha * alpha)); } - let [r, g, b, _] = self.doc.resolve_color(swatch, tint)?.to_rgba8(1.0); - let mut c = craft_pptx::ColorRef::rgb(craft_pptx::Rgba::rgb(r, g, b)); - if alpha < 1.0 { - c = c.with(craft_pptx::ColorTransform::Alpha((alpha * 100_000.0).round() as i32)); - } - Some(c) + Some(color_with_opacity(self.doc.resolve_color(swatch, tint)?, alpha)) } fn model_fill(&mut self, fill: &designcraft_doc::Fill, closed: bool, opacity: f32) -> craft_pptx::Fill { @@ -389,9 +386,9 @@ impl<'a> Exporter<'a> { let stops = gradient .expanded_stops() .into_iter() - .map(|(offset, color, alpha)| { - let [r, g, b, a] = color.to_rgba8(alpha * opacity); - craft_pptx::style::GradientStop { pos: f64::from(offset), color: craft_pptx::ColorRef::rgb(craft_pptx::Rgba::rgba(r, g, b, a)) } + .map(|(offset, color, alpha)| craft_pptx::style::GradientStop { + pos: f64::from(offset), + color: color_with_opacity(color, alpha * opacity), }) .collect(); let shape = match gradient.kind { diff --git a/crates/pptx/src/text.rs b/crates/pptx/src/text.rs index f50cc8694..c00806303 100644 --- a/crates/pptx/src/text.rs +++ b/crates/pptx/src/text.rs @@ -397,13 +397,11 @@ pub(crate) fn model_body(ex: &mut Exporter, seg: &Segment, k: f64, opacity: f32, fn color(ex: &Exporter, swatch: &str, tint: f32, opacity: f32) -> Option { let color = if let Some(gradient) = resolve_gradient(&ex.doc.swatches, swatch) { let (_, color, alpha) = gradient.expanded_stops().into_iter().next()?; - let [r, g, b, a] = color.to_rgba8(alpha * opacity); - craft_pptx::Rgba::rgba(r, g, b, a) + return Some(crate::slide::color_with_opacity(color, alpha * opacity)); } else { - let [r, g, b, a] = ex.doc.resolve_color(swatch, tint)?.to_rgba8(opacity); - craft_pptx::Rgba::rgba(r, g, b, a) + ex.doc.resolve_color(swatch, tint)? }; - Some(craft_pptx::ColorRef::rgb(color)) + Some(crate::slide::color_with_opacity(color, opacity)) } fn run_props(ex: &mut Exporter, run: Option<&Run>, size: f64, k: f64, opacity: f32) -> craft_pptx::text::RunProps { diff --git a/crates/textimport/src/docx.rs b/crates/textimport/src/docx.rs index b7bd274df..0393ef948 100644 --- a/crates/textimport/src/docx.rs +++ b/crates/textimport/src/docx.rs @@ -309,6 +309,34 @@ fn style_records(styles: &StyleSheet) -> (Vec, Vec (paras, chars, names) } +/// Plain text under the importer's accepted-changes policy, with inline objects expanded. +fn accepted_plain_text(p: &Paragraph) -> String { + let mut out = String::with_capacity(p.text.len()); + let mut object_i = 0usize; + let mut runs = p.run_ranges().peekable(); + for (at, c) in p.text.char_indices() { + while runs.peek().is_some_and(|(range, _)| range.end <= at) { + runs.next(); + } + let deleted = runs.peek().is_some_and(|(range, props)| range.contains(&at) && props.del.is_some()); + if deleted { + if c == craft_wordmodel::para::OBJ { + object_i = object_i.saturating_add(1); + } + continue; + } + if c == craft_wordmodel::para::OBJ { + if let Some(object) = p.objects.get(object_i) { + out.push_str(object.plain_text()); + } + object_i = object_i.saturating_add(1); + } else { + out.push(c); + } + } + out +} + fn plain_blocks(blocks: &[std::sync::Arc]) -> String { let mut out = String::new(); let mut first = true; @@ -319,7 +347,7 @@ fn plain_blocks(blocks: &[std::sync::Arc]) -> String { out.push('\n'); } first = false; - let text = p.final_text(); + let text = accepted_plain_text(p); let is_break = |c: char| matches!(c, designcraft_doc::PAGE_BREAK | designcraft_doc::COLUMN_BREAK); out.push_str(&text.chars().map(|c| if is_break(c) { '\n' } else { c }).collect::()); } diff --git a/crates/textimport/src/docx/tests.rs b/crates/textimport/src/docx/tests.rs index d49b2a2cc..b0dd74110 100644 --- a/crates/textimport/src/docx/tests.rs +++ b/crates/textimport/src/docx/tests.rs @@ -256,6 +256,31 @@ fn imports_styles_runs_footnotes_and_tables() { assert_eq!(i.char_styles[0].chars.font_style.as_deref(), Some("Italic")); } +/// Word stores its built-in heading names in lower case (`heading 1`); they come in under the +/// name Word shows, `Heading 1`, as in v0.21.0. +#[test] +fn built_in_headings_take_the_name_word_shows() { + let styles = format!( + r#" + + + + "# + ); + let document = format!( + r#" + One + Two + Nine + "# + ); + let i = import(&docx(&document, &styles, "")).unwrap(); + let used: Vec<&str> = i.story.paras.iter().map(|p| p.style.as_str()).collect(); + assert_eq!(used, ["Heading 1", "Heading 2", "Heading 9"]); + let names: Vec<&str> = i.para_styles.iter().map(|s| s.name.as_str()).collect(); + assert_eq!(names, ["Heading 1", "Heading 2", "Heading 9"]); +} + /// A content control inside a paragraph (`w:sdt`) keeps its text, also around a hyperlink. #[test] fn inline_content_control_text_is_kept() { diff --git a/crates/textimport/src/xlsx.rs b/crates/textimport/src/xlsx.rs index df72ef730..f49bdd220 100644 --- a/crates/textimport/src/xlsx.rs +++ b/crates/textimport/src/xlsx.rs @@ -38,9 +38,11 @@ fn sheet_cells( let mut cut = false; let result = package.sheet(entry, |row| { for cell in row.cells { - let value = match &cell.value { - craft_xlsx::CellValue::Invalid(s) => s.clone(), - other => display(other.resolve(&strings, date_1904)), + let value = match cell.value { + // A value that doesn't read as its type says (`inf`, `n/a` in a number cell) is + // shown as written, as the importer did before the shared reader. + craft_xlsx::CellValue::Invalid(raw) => raw, + value => display(value.resolve(&strings, date_1904)), }; text_bytes = text_bytes.saturating_add(value.len()); if cells.len() >= max_cells || text_bytes > max_text_bytes { @@ -418,6 +420,15 @@ mod tests { } } + #[test] + fn number_cells_that_are_not_numbers_show_as_written() { + for text in ["inf", "Infinity", "NaN", "n/a", "12 apples"] { + let book = one_value(&format!(r#"{text}"#)); + let rows = crate::xlsx_records(&book, None).unwrap(); + assert_eq!(rows[1][0], text, "cell {text}"); + } + } + #[test] fn cached_string_values_are_not_reformatted_as_numbers() { for text in ["00123", "1e3", "12.0", " 42 "] {