diff --git a/docs/format/idml-values.md b/docs/format/idml-values.md
index 4f62cbf..6a58d1a 100644
--- a/docs/format/idml-values.md
+++ b/docs/format/idml-values.md
@@ -114,42 +114,41 @@ element in the package.
## Story values
-Every `Story` element in the 240 corpus IDML files (2,094 stories) has
-these values, which the converter writes on every story. No INDD field
-for them is identified; the story objects examined have no attributes in
-their attribute list (chunk 0x23F, always empty), and no story chunk has
-a value that varies with them.
+`tools/element_values.py` collects the values of `Story`, `XmlStory`
+and their `StoryPreference` and `InCopyExportOption` children from the
+683 corpus IDML files (`element_values.xml`); the converter writes them
+where the INDD gives no value:
-| Element | Values | Same in |
+| Element | Values kept | Versions |
|---|---|---|
-| `Story` | `TrackChanges="false"`, `StoryTitle="$ID/"`, `AppliedNamedGrid="n"` | 2,094 of 2,094 |
-| `Story` | `UserText="true"` | 2,090 of 2,090 with DOM 12 or later (written for version 12 and later) |
-| `Story` | `IsEndnoteStory="false"` | 3,094 of 3,094 with DOM 13.0–14.0 and 0 of 2,467 with DOM 12 (`footnotes.md`); written for version 13 and later, `true` for the endnote story |
-| `StoryPreference` | `OpticalMarginAlignment="false"`, `OpticalMarginSize="12"`, `FrameType="TextFrameType"`, `StoryOrientation="Horizontal"`, `StoryDirection="LeftToRightDirection"` | 2,094 of 2,094 |
-| `InCopyExportOption` | `IncludeGraphicProxies="true"`, `IncludeAllResources="false"` | 2,094 of 2,094 |
+| `Story` | `TrackChanges="false"`, `AppliedNamedGrid="n"` | 7 on |
+| `Story`, `XmlStory` | `UserText="true"` where written | 11 on; IDML has it from version 11.2 (none of the 3,184 stories of DOM 10.0 to 11.0, every story from 11.2), and the converter writes it from INDD version 11.2 |
+| `StoryPreference` | `FrameType="TextFrameType"`, `StoryOrientation="Horizontal"` | 7 on |
+| `InCopyExportOption` of stories | `IncludeGraphicProxies="true"`, `IncludeAllResources="false"` | 7 on |
-`StoryPreference` and `InCopyExportOption` are the first two children of
-every story, in that order, as the IDML schema puts them. Optical margin
-alignment is off in every corpus story, so the field that turns it on is
-not known and a document that uses it is converted without it.
-`AppliedTOCStyle` is left out: it names a TOC style in 4 stories.
+The other story values are read from the INDD: `StoryTitle`,
+`StoryDirection` and the optical margin from story chunks, with the
+value of every story without the chunk when it is absent (`objects.md`,
+story settings); `IsEndnoteStory` from the story class (`footnotes.md`);
+`AppliedTOCStyle` from chunk 0x8C40.
`StoryOrientation` is read from the story's frames when they agree
(`objects.md`, text orientation); the observed `Horizontal` is written
only for other stories. For a sample typeset vertically, no field was
-found that sets `StoryDirection` or `FrameType` apart from horizontal
-samples, so these keep the observed values there too. Its object styles
-store direction code 1, as horizontal samples do.
+found that sets `FrameType` apart from horizontal samples, so it keeps
+the observed value there too.
## Graphic settings without an INDD field
-All 496 `Image` elements in the 240 corpus IDML files (119 files) have
-`ClippingPathSettings` with `InvertPath="false"`,
-`IncludeInsideEdges="false"`, `RestrictToFrame="false"` and
-`AppliedPathName="$ID/"`, and `ImageIOPreference` with
-`AllowAutoEmbedding="true"`. The 386 PDF and 49 EPS graphics with
-`ClippingPathSettings` have the same four values. The converter writes
-them (`objects.md`, clipping path settings).
+`element_values.xml` holds the `ClippingPathSettings` values of every
+`Image`, `PDF` and `EPS` element in the 683 corpus IDML files:
+`ClippingType="None"`, `InvertPath="false"`, `IncludeInsideEdges="false"`,
+`RestrictToFrame="false"` and `AppliedPathName="$ID/"` (and for PDF and
+EPS also the values the converter reads for images). EPS graphics occur
+only up to DOM 20, so a DOM 21 EPS gets only the values read from the
+INDD. Every `ImageIOPreference` has `AllowAutoEmbedding="true"`. The
+converter writes the values read from the INDD first (`objects.md`,
+clipping path settings).
Over the 5,131 graphics of the trustworthy pairs, every graphic has
`LocalDisplaySetting="Default"`; every image (3,607)
@@ -224,16 +223,21 @@ version; the converter writes it from 13.1.
## Composite font entries
-`Locked="true"` is in all 1,440 `CompositeFontEntry` elements of the
-240 corpus IDML files. No INDD field for it is identified; the converter
-writes it on every entry (`fonts.md`).
+The converter writes only the built-in composite font `[No composite
+font]`. All 5,159 of its `CompositeFontEntry` elements in the 683 corpus
+IDML files have `Locked="true"`, `RelativeSize="100"`,
+`BaselineShift="0"`, `HorizontalScale="100"` and `VerticalScale="100"`.
+No INDD field for `Locked` is identified; the converter writes it on
+every entry, and the other four where the entry's stored numbers are
+those of every entry (`fonts.md`). Entries of other composite fonts
+have other values.
## Inks
-All 973 `Ink` elements of the 240 corpus IDML files have
-`InkType="Normal"`, `PrintInk="true"` and `ConvertToProcess="false"`.
-No INDD field for them is identified; the converter writes them on every
-ink (`objects.md`).
+Every `Ink` element of the 683 corpus IDML files has `InkType="Normal"`
+and `PrintInk="true"` (`element_values.xml`); the converter writes them
+on every ink. `ConvertToProcess` is read from the INDD (`objects.md`,
+inks).
## Values of other elements
@@ -443,9 +447,11 @@ blocks of `element_values.xml`, `root_values.xml` and
`object_style_values.xml` are not used, because those files are keyed
by major version only.
-All 3,412 `InCopyExportOption` elements of rectangles, ovals and polygons
-have `IncludeGraphicProxies="true"` and `IncludeAllResources="false"`,
-and the converter writes them on those items.
+Every `InCopyExportOption` of a rectangle, oval or polygon in the 683
+corpus IDML files has `IncludeGraphicProxies="true"` and
+`IncludeAllResources="false"` (`element_values.xml`; ovals from DOM 8,
+as no DOM 7 file has one). The converter writes the element with these
+values on those items.
## Column direction of pages
diff --git a/docs/format/objects.md b/docs/format/objects.md
index f35bcd3..225ff1e 100644
--- a/docs/format/objects.md
+++ b/docs/format/objects.md
@@ -2073,11 +2073,15 @@ of the name:
| 26 | u32, one less than the IDML value | `TrapOrder` | 314 of 314 |
| 32 | f64 | `Frequency` | 314 of 314 |
| 40 | f64 | `Angle` | 314 of 314 (0, 15, 27, 45, 63 and 75) |
+| 56 | u8 | `ConvertToProcess` (1 `true`) | 2,065 of 2,065 inks of the trustworthy pairs (3 `true`) |
Byte 2 is 1 for the four process inks and 0 for spot inks; its meaning
-is not known. `InkType="Normal"`, `PrintInk="true"` and
-`ConvertToProcess="false"` are in all 973 IDML inks and are written from
-that observation (`idml-values.md`). The schema puts inks after the
+is not known. The u8 at 56 is `ConvertToProcess` (1 `true`, 0 `false`):
+it is 1 for the 3 inks of the trustworthy pairs whose IDML has `true`
+(one spot ink, in three copies of one document) and 0 for the other
+2,062; no other byte separates them. `InkType="Normal"` and
+`PrintInk="true"` are in every IDML ink and are written from that
+observation (`idml-values.md`). The schema puts inks after the
colours and before the tints.
In 41 files without an IDML (InDesign 6.0, 13.x and 14.x, from two
diff --git a/src/idml/element_values.xml b/src/idml/element_values.xml
index ba77185..89550ac 100644
--- a/src/idml/element_values.xml
+++ b/src/idml/element_values.xml
@@ -19,8 +19,11 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
-
+
+
+
@@ -58,6 +61,18 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -174,6 +189,11 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
+
+
+
+
@@ -185,6 +205,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
@@ -313,6 +334,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
@@ -386,6 +408,10 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
+
+
+
+
diff --git a/src/idml/graphic.rs b/src/idml/graphic.rs
index 3edac28..4b2f167 100644
--- a/src/idml/graphic.rs
+++ b/src/idml/graphic.rs
@@ -70,7 +70,7 @@ impl Writer<'_> {
/// those every exported IDML has, and a graphic without chunk 0x2C1A
/// has the values every such graphic has in IDML. See
/// `docs/format/objects.md`.
- pub(super) fn clipping(x: &mut Xml, g: &Graphic) {
+ pub(super) fn clipping(&self, x: &mut Xml, g: &Graphic, tag: &str) {
let (high_resolution, threshold, tolerance, inset, index) = match &g.clipping {
Some(c) if c.kind == 0 => (
match c.high_resolution {
@@ -92,19 +92,15 @@ impl Writer<'_> {
"-1".into(),
),
};
- x.start("ClippingPathSettings")
- .attr("ClippingType", "None")
- .attr("InvertPath", "false")
- .attr("IncludeInsideEdges", "false")
- .attr("RestrictToFrame", "false");
+ x.start("ClippingPathSettings");
if let Some(h) = high_resolution {
x.attr("UseHighResolutionImage", h);
}
x.attr("Threshold", threshold)
.attr("Tolerance", tolerance)
.attr("InsetFrame", inset)
- .attr("AppliedPathName", "$ID/")
.attr("Index", index);
+ x.attrs_missing(self.observed(&format!("{tag}/ClippingPathSettings")).iter());
x.end();
}
@@ -314,7 +310,7 @@ impl Writer<'_> {
);
x.end();
if g.kind != GraphicKind::Svg {
- Self::clipping(x, g);
+ self.clipping(x, g, tag);
}
if g.kind == GraphicKind::Image {
Self::image_io(x, g);
diff --git a/src/idml/resources.rs b/src/idml/resources.rs
index 2a8105e..6b34446 100644
--- a/src/idml/resources.rs
+++ b/src/idml/resources.rs
@@ -151,20 +151,22 @@ impl Writer<'_> {
("Self", format!("Ink/{}", self_name(&i.name.idml()))),
("Name", i.name.idml()),
("Angle", num(i.angle)),
- // These three are the same in every Ink of the corpus
- // IDML files (idml-values.md).
- ("ConvertToProcess", "false".into()),
- ("Frequency", num(i.frequency)),
];
+ if let Some(c) = i.convert_to_process {
+ attrs.push(("ConvertToProcess", c.to_string()));
+ }
+ attrs.push(("Frequency", num(i.frequency)));
if let Some(d) = i.neutral_density {
attrs.push(("NeutralDensity", num(d)));
}
- attrs.extend([
- ("PrintInk", "true".into()),
- ("TrapOrder", i.trap_order.to_string()),
- ("InkType", "Normal".into()),
- ]);
- x.empty("Ink", &attrs);
+ attrs.push(("TrapOrder", i.trap_order.to_string()));
+ x.start("Ink");
+ for (k, v) in &attrs {
+ x.attr(k, v);
+ }
+ // The values every IDML has on an ink (idml-values.md).
+ x.attrs_missing(self.observed("Ink").iter());
+ x.end();
}
// The document's constant shade, with the values every IDML has
// on one (idml-values.md); its contents are the stored numbers in
diff --git a/src/idml/spread.rs b/src/idml/spread.rs
index cd7eeac..70617c8 100644
--- a/src/idml/spread.rs
+++ b/src/idml/spread.rs
@@ -479,13 +479,13 @@ impl Writer<'_> {
}
Self::text_wrap_preference(x, item.text_wrap.as_ref(), None);
if frame {
- x.empty(
- "InCopyExportOption",
- &[
- ("IncludeGraphicProxies", "true".into()),
- ("IncludeAllResources", "false".into()),
- ],
- );
+ // The values every IDML has (idml-values.md, page items).
+ let observed = self.observed(&format!("{tag}/InCopyExportOption"));
+ if !observed.is_empty() {
+ x.start("InCopyExportOption");
+ x.attrs_missing(observed.iter());
+ x.end();
+ }
}
for (effect, attr, v) in transparency::write(
self,
diff --git a/src/idml/story.rs b/src/idml/story.rs
index 5976880..e4efc10 100644
--- a/src/idml/story.rs
+++ b/src/idml/story.rs
@@ -40,11 +40,12 @@ impl Writer<'_> {
/// The start tag of a `Story` or `XmlStory` with its attributes.
pub(super) fn story_start(&self, x: &mut Xml, tag: &str, s: &Story) {
x.start(tag).attr("Self", uref(Some(s.uid)));
- // Values every exported IDML has on every story, from the DOM
- // version where they first appear (docs/format/idml-values.md).
- let major = self.doc.version.major;
- if major >= 12 {
- x.attr("UserText", "true");
+ // `UserText` from version 11.2, with the value every IDML has
+ // (docs/format/idml-values.md, stories).
+ let v = &self.doc.version;
+ let major = v.major;
+ if (major, v.minor) >= (11, 2) {
+ x.attrs_missing(values::when_written(tag, major).iter());
}
// From DOM 13 (footnotes.md).
if major >= 13 {
@@ -52,9 +53,7 @@ impl Writer<'_> {
}
// Without chunk 0xA44C the title is `$ID/` (objects.md, stories).
let title = s.settings.title.as_deref().unwrap_or("$ID/");
- x.attr("TrackChanges", "false")
- .attr("StoryTitle", title)
- .attr("AppliedNamedGrid", "n");
+ x.attr("StoryTitle", title);
// The TOC style that made the story, if any (objects.md).
let toc = s
.toc_style
@@ -63,6 +62,8 @@ impl Writer<'_> {
"AppliedTOCStyle",
toc.map_or("n".into(), Self::toc_style_ref),
);
+ // The values every IDML has on every story (idml-values.md).
+ x.attrs_missing(self.observed(tag).iter());
}
pub(super) fn xml_element_start(x: &mut Xml, e: &XmlElement) {
@@ -97,25 +98,25 @@ impl Writer<'_> {
prefs.push(("OpticalMarginAlignment", a.into()));
}
prefs.push(("OpticalMarginSize", size));
- prefs.push(("FrameType", "TextFrameType".into()));
// Read from the story's frames; otherwise the value every
// exported IDML has (`idml-values.md`).
- let orientation = match s.orientation {
- Some(Orientation::Vertical) => "Vertical",
- _ => "Horizontal",
- };
- prefs.push(("StoryOrientation", orientation.into()));
+ match s.orientation {
+ Some(Orientation::Vertical) => prefs.push(("StoryOrientation", "Vertical".into())),
+ Some(Orientation::Horizontal) => prefs.push(("StoryOrientation", "Horizontal".into())),
+ None => {}
+ }
if let Some(d) = direction {
prefs.push(("StoryDirection", d.into()));
}
- x.empty("StoryPreference", &prefs);
- x.empty(
- "InCopyExportOption",
- &[
- ("IncludeGraphicProxies", "true".into()),
- ("IncludeAllResources", "false".into()),
- ],
- );
+ x.start("StoryPreference");
+ for (k, v) in &prefs {
+ x.attr(k, v);
+ }
+ x.attrs_missing(self.observed("Story/StoryPreference").iter());
+ x.end();
+ x.start("InCopyExportOption");
+ x.attrs_missing(self.observed("Story/InCopyExportOption").iter());
+ x.end();
let scope = uref(Some(s.uid));
// The element whose content is the story holds all its text.
let element = s
diff --git a/src/model/color.rs b/src/model/color.rs
index 559d768..7e5834d 100644
--- a/src/model/color.rs
+++ b/src/model/color.rs
@@ -391,7 +391,8 @@ impl Color {
/// An ink (class 0x1F07). Chunk 0x1F0D: flag byte and name, then fields
/// at offsets from the end of the name: f64 neutral density at 14, u32
-/// trap order − 1 at 26, f64 frequency at 32, f64 angle at 40.
+/// trap order − 1 at 26, f64 frequency at 32, f64 angle at 40, u8 convert
+/// to process at 56.
#[derive(Debug, Clone, PartialEq)]
pub struct Ink {
pub uid: u32,
@@ -402,6 +403,8 @@ pub struct Ink {
pub trap_order: u32,
pub frequency: f64,
pub angle: f64,
+ /// `ConvertToProcess`: u8 at 56 (1 `true`, 0 `false`).
+ pub convert_to_process: Option,
}
impl Ink {
@@ -424,6 +427,11 @@ impl Ink {
trap_order: enc.cursor(&d[end + 26..]).u32()? + 1,
frequency: f(32)?,
angle: f(40)?,
+ convert_to_process: match d.get(end + 56) {
+ Some(0) => Some(false),
+ Some(1) => Some(true),
+ _ => None,
+ },
}))
}
}
diff --git a/tools/element_values.py b/tools/element_values.py
index b450b48..56fe971 100644
--- a/tools/element_values.py
+++ b/tools/element_values.py
@@ -74,6 +74,10 @@ ELEMENTS = [
"Document/LinkedPageItemOption", "Document/WatermarkPreference",
"Document/TaggedPDFPreference", "Document/AdjustLayoutPreference",
"Document/HTMLFXLExportPreference", "Document/PublishExportPreference",
+ "Story", "XmlStory", "Story/StoryPreference", "Story/InCopyExportOption",
+ "Rectangle/InCopyExportOption", "Oval/InCopyExportOption",
+ "Polygon/InCopyExportOption", "Image/ClippingPathSettings",
+ "PDF/ClippingPathSettings", "EPS/ClippingPathSettings", "Ink",
]
# The top-level elements of Resources/Preferences.xml, as paths
# "Preferences/". tools/root_values.py collects them from the IDML
@@ -126,6 +130,8 @@ WHEN_WRITTEN = {
"MinimumFirstBaselineOffset",
],
"ParagraphStyle": ["EmitCss"],
+ "Story": ["UserText"],
+ "XmlStory": ["UserText"],
"TOCStyle": ["SetStoryDirection"],
"CharacterStyle": ["EmitCss", "SplitDocument"],
}