From 0fe8d4bc978195baee029b48a95af70672d18fd8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 07:38:33 -0500 Subject: [PATCH] Write text wrap preferences through shared IDML model --- crates/idml/src/model/spread.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/idml/src/model/spread.rs b/crates/idml/src/model/spread.rs index bfef6094b..0011ddb96 100644 --- a/crates/idml/src/model/spread.rs +++ b/crates/idml/src/model/spread.rs @@ -605,6 +605,30 @@ impl TextWrapPreference { pub fn offsets(&self) -> Option<[f64; 4]> { self.offsets } + + /// Writes the IDML preference structure around caller-supplied enum values and path geometry. + pub fn to_el(mode: &str, inverse: bool, side: &str, contour: &str, offsets: [f64; 4], paths: &[PathGeometry]) -> El { + use crate::value::num; + + let mut properties = El::new("Properties"); + for path in paths { + properties.push(path.to_el()); + } + properties.push( + El::new("TextWrapOffset") + .with_attr("Top", num(offsets[0])) + .with_attr("Left", num(offsets[1])) + .with_attr("Bottom", num(offsets[2])) + .with_attr("Right", num(offsets[3])), + ); + El::new("TextWrapPreference") + .with_attr("Inverse", if inverse { "true" } else { "false" }) + .with_attr("ApplyToMasterPageOnly", "false") + .with_attr("TextWrapSide", side) + .with_attr("TextWrapMode", mode) + .with_child(properties) + .with_child(El::new("ContourOption").with_attr("ContourType", contour).with_attr("IncludeInsideEdges", "false")) + } } /// Type-on-a-path settings.