From 6f8a8fe932f7dc0403f22dfd1f74aea98785e3a0 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Wed, 7 Oct 2026 16:24:18 +0000 Subject: [PATCH] feat: write the stroke weight of items that have none of their own --- docs/format/objects.md | 12 ++++++++++++ src/idml/mod.rs | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/format/objects.md b/docs/format/objects.md index beddeb7..3c58c2d 100644 --- a/docs/format/objects.md +++ b/docs/format/objects.md @@ -589,6 +589,18 @@ set the converter leaves both attributes out. In 14,918 items with chunk 0x1424 the master item is 0; in 197 of them the list still holds IDs, and IDML writes the attribute empty. +**Stroke weight without an attribute.** An item whose attribute list has +no stroke weight (attribute 0x6E65) and whose object style is `[None]` +has `StrokeWeight="1"` in IDML: in the trustworthy pairs, 31,252 of +31,252 polygons, 5,294 of 5,294 rectangles, 702 of 702 ovals, 214 of +214 graphic lines and 4,248 of 4,263 text frames (15 have 0.28). With +another object style the attribute is absent in IDML (the style supplies +it), apart from 160 text frames with `[Normal Text Frame]` and 10 lines +with styles of their own, which have 1. Groups vary (1,166 without the +attribute, 625 with 1 and 30 with other values, in 200 of the pairs) +and get none. The converter +writes 1 for items other than groups with the style `[None]`. + ## Text wrap Page items (class 0x6201 and groups, 0x401) and placed graphics have diff --git a/src/idml/mod.rs b/src/idml/mod.rs index dfbfaff..af06041 100644 --- a/src/idml/mod.rs +++ b/src/idml/mod.rs @@ -3740,10 +3740,19 @@ impl Writer<'_> { x.attr("ContentType", content); } self.item_attrs(x, &item.attrs); - if let Some(os) = item + let style = item .object_style - .and_then(|u| self.doc.object_styles.get(&u)) + .and_then(|u| self.doc.object_styles.get(&u)); + // An item without a stroke weight of its own and with the object + // style [None] has `StrokeWeight="1"` in IDML (objects.md, page + // item settings); groups vary. + if tag != "Group" + && item.attrs.0.iter().all(|(id, _)| *id != 0x6E65) + && style.is_some_and(|os| os.builtin && os.name == "[None]") { + x.attr("StrokeWeight", "1"); + } + if let Some(os) = style { let name = if os.builtin { format!("$ID/{}", os.name) } else {