diff --git a/Cargo.lock b/Cargo.lock index 839f5837b..d49aaa55e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1242,10 +1242,10 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8#2dc9cd407b240fb405eb5acbff88d6f81cec5eb8" +source = "git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623" dependencies = [ - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", - "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", + "craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", "thiserror 2.0.21", ] @@ -1647,7 +1647,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8#2dc9cd407b240fb405eb5acbff88d6f81cec5eb8" +source = "git+https://github.com/storytold/craft-libs?rev=40525913633942f84b06d4837a8d90534a55d63f#40525913633942f84b06d4837a8d90534a55d63f" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1656,7 +1656,7 @@ 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=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623" dependencies = [ "quick-xml 0.41.0", "thiserror 2.0.21", @@ -1730,7 +1730,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8#2dc9cd407b240fb405eb5acbff88d6f81cec5eb8" +source = "git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623#7c6abc70a679334a7407087b88544a49058e9623" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2021,7 +2021,7 @@ 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=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=f23b0f33f0d00b157476533a43cbbcfd901aa1f1)", "designcraft-color", "designcraft-compose", @@ -2103,9 +2103,9 @@ name = "designcraft-idml" version = "0.20.1" dependencies = [ "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", "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=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", "designcraft-color", "designcraft-compose", "designcraft-doc", @@ -2222,7 +2222,7 @@ version = "0.20.1" dependencies = [ "craft-docx", "craft-file-formats", - "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=2dc9cd407b240fb405eb5acbff88d6f81cec5eb8)", + "craft-idml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=7c6abc70a679334a7407087b88544a49058e9623)", "craft-rtf", "craft-wordmodel", "craft-xlsx", diff --git a/Cargo.toml b/Cargo.toml index d4f605861..a9d0f8053 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,10 +16,10 @@ craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "4052591363 craft-designcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "19692b6190465671e41967c75d0cd4c439d0c84c", 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 = "2dc9cd407b240fb405eb5acbff88d6f81cec5eb8", version = "=0.1.0" } +craft-idml = { git = "https://github.com/storytold/craft-libs", rev = "7c6abc70a679334a7407087b88544a49058e9623", 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 = "2dc9cd407b240fb405eb5acbff88d6f81cec5eb8", version = "=0.1.0" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "7c6abc70a679334a7407087b88544a49058e9623", 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-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "ba24fe2435adb3c81ad6057faf36365fbba736cf", version = "=0.1.0" } diff --git a/crates/idml/src/export/item.rs b/crates/idml/src/export/item.rs index 464703d9c..35e789ae7 100644 --- a/crates/idml/src/export/item.rs +++ b/crates/idml/src/export/item.rs @@ -326,24 +326,15 @@ impl<'a> Ex<'a> { /// `rule_color` is the IDML reference of the column rule's swatch. /// `TextWrapPreference` of a page item or a placed graphic. fn text_wrap_pref(w: &designcraft_doc::TextWrap) -> El { - with_props( - El::new("TextWrapPreference") - .attr("Inverse", bool_s(w.invert)) - .attr("ApplyToMasterPageOnly", "false") - .attr("TextWrapSide", names::wrap_side_out(w.side)) - .attr("TextWrapMode", names::wrap_mode_out(w.mode)), - w.path - .iter() - .filter(|p| !p.is_empty()) - .map(path_geometry) - .chain([El::new("TextWrapOffset") - .attr("Top", num(w.offsets[0])) - .attr("Left", num(w.offsets[1])) - .attr("Bottom", num(w.offsets[2])) - .attr("Right", num(w.offsets[3]))]) - .collect(), - ) - .child(El::new("ContourOption").attr("ContourType", names::contour_type_out(w.contour)).attr("IncludeInsideEdges", "false")) + let paths: Vec<_> = w.path.iter().filter(|p| !p.is_empty()).map(path_geometry_value).collect(); + crate::xml::from_craft(craft_idml::model::TextWrapPreference::to_el( + names::wrap_mode_out(w.mode), + w.invert, + names::wrap_side_out(w.side), + names::contour_type_out(w.contour), + w.offsets, + &paths, + )) } pub(super) fn text_frame_pref(o: &TextFrameOptions, rule_color: &str) -> El { @@ -399,7 +390,11 @@ fn clipping_settings(c: &designcraft_doc::ClippingPath) -> El { } fn path_geometry(path: &PathData) -> El { - let geometry = craft_idml::model::PathGeometry { + crate::xml::from_craft(path_geometry_value(path).to_el()) +} + +fn path_geometry_value(path: &PathData) -> craft_idml::model::PathGeometry { + craft_idml::model::PathGeometry { paths: path .subpaths .iter() @@ -412,8 +407,7 @@ fn path_geometry(path: &PathData) -> El { .collect(), }) .collect(), - }; - crate::xml::from_craft(geometry.to_el()) + } } /// IDML corner names for anchors 0..4 of a path (by position on its bounding box).