mirror of
https://github.com/storytold/indd-utils.git
synced 2026-11-30 10:04:22 +01:00
feat: take story, frame, clipping and ink constants from the value files
The writer wrote these as literals. element_values.py now collects Story, XmlStory, Story/StoryPreference, the InCopyExportOption of stories, rectangles, ovals and polygons, the ClippingPathSettings of images, PDF and EPS graphics, and Ink; the writer reads them from element_values.xml after the values it reads from the INDD. - UserText (a WhenWritten value) is written from version 11.2, where IDML starts to have it (was 12). - Ink ConvertToProcess is read from byte 56 after the ink name; it was the only ink value that varies (3 inks true). - InCopyExportOption of ovals and the EPS clipping values follow the versions the corpus shows (ovals from DOM 8, EPS up to DOM 20). compare.py --exclude own/: - trustworthy value coverage 98.03% -> 98.03% (+771 values: UserText 768, ConvertToProcess 3); all pairs 96.12% -> 96.13% (+1,211) - extra values: trustworthy unchanged; all pairs +43 (UserText in stale pairs whose IDML is older) - compare.py --all with schemas: 0 schema failures on pairs; files without a reference as before
This commit is contained in:
1 parent
c98436d3b2
commit
64f08256e3
9 files changed
+137
-88
No files matched your search
+42
-36
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,8 +19,11 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
<ActualMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/" />
|
||||
</Properties>
|
||||
</ObjectExportOption>
|
||||
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
|
||||
</Rectangle>
|
||||
<Polygon StoryTitle="$ID/" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0" />
|
||||
<Polygon StoryTitle="$ID/" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0">
|
||||
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
|
||||
</Polygon>
|
||||
<GraphicLine LockState="None" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0" />
|
||||
<Group GradientStrokeAngle="0" LocalDisplaySetting="Default" GradientFillHiliteLength="0" GradientFillHiliteAngle="0" GradientStrokeHiliteLength="0" GradientStrokeHiliteAngle="0" />
|
||||
<Spread PageTransitionType="None" PageTransitionDirection="NotApplicable" PageTransitionDuration="Medium" ShowMasterItems="true" FlattenerOverride="Default">
|
||||
@@ -58,6 +61,18 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
<WatermarkPreference Present="true" WatermarkVisibility="false" WatermarkDoPrint="false" WatermarkDrawInBack="true" WatermarkText="" WatermarkFontPointSize="48" WatermarkOpacity="50" WatermarkRotation="0" WatermarkHorizontalPosition="WatermarkHCenter" WatermarkHorizontalOffset="0" WatermarkVerticalPosition="WatermarkVCenter" WatermarkVerticalOffset="0" />
|
||||
<TaggedPDFPreference StructureOrder="UseXMLStructure" />
|
||||
</Document>
|
||||
<Story TrackChanges="false" AppliedNamedGrid="n">
|
||||
<StoryPreference FrameType="TextFrameType" StoryOrientation="Horizontal" />
|
||||
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
|
||||
</Story>
|
||||
<XmlStory AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n" />
|
||||
<Image>
|
||||
<ClippingPathSettings ClippingType="None" InvertPath="false" IncludeInsideEdges="false" RestrictToFrame="false" InsetFrame="0" AppliedPathName="$ID/" Index="-1" />
|
||||
</Image>
|
||||
<PDF>
|
||||
<ClippingPathSettings ClippingType="None" InvertPath="false" IncludeInsideEdges="false" RestrictToFrame="false" UseHighResolutionImage="true" Threshold="25" Tolerance="2" InsetFrame="0" AppliedPathName="$ID/" Index="-1" />
|
||||
</PDF>
|
||||
<Ink PrintInk="true" InkType="Normal" />
|
||||
<Preferences>
|
||||
<PrintPreference PrintFile="" Collating="false" ReverseOrder="false" Sequence="All" PrintMasterPages="false" PrintNonprinting="false" PrintGuidesGrids="false" PaperOffset="0" PaperGap="0" PaperTransverse="false" TilingType="Auto" Trapping="Off" Flip="None" Negative="false" SimulateOverprint="false" PrintCyan="true" PrintMagenta="true" PrintYellow="true" PrintBlack="true" SourceSpace="UseDocument" OPIImageReplacement="false" OmitEPS="false" OmitPDF="false" OmitBitmaps="false" IgnoreSpreadOverrides="false" CompositeScreening="$ID/kDefault" PrintLayers="VisiblePrintableLayers">
|
||||
<Properties>
|
||||
@@ -174,6 +189,11 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
<HTMLExportPreference ExportOrder="LayoutOrder" BulletExportOption="UnorderedList" NumberedListExportOption="OrderedList" ImageExportOption="OptimizedImage" ImageExportResolution="Ppi150" CustomImageSizeOption="SizeFixed" PreserveLayoutAppearence="false" ImageAlignment="AlignCenter" ImageSpaceBefore="0" ImageSpaceAfter="0" ImageConversion="Automatic" GIFOptionsPalette="AdaptivePalette" GIFOptionsInterlaced="false" JPEGOptionsQuality="High" JPEGOptionsFormat="ProgressiveEncoding" Level="5" IgnoreObjectConversionSettings="false" ServerPath="" ImageExtension=".jpg" PreserveLocalOverride="true" LeftMargin="0" RightMargin="0" TopMargin="0" BottomMargin="0" MarginUnit="CssPixel" IncludeCSSDefinition="true" CSSExportOption="EmbeddedCSS" />
|
||||
</Preferences>
|
||||
</Values>
|
||||
<Values MinimumVersion="8" MaximumVersion="20">
|
||||
<EPS>
|
||||
<ClippingPathSettings ClippingType="None" InvertPath="false" IncludeInsideEdges="false" RestrictToFrame="false" UseHighResolutionImage="true" Threshold="25" Tolerance="2" InsetFrame="0" AppliedPathName="$ID/" Index="-1" />
|
||||
</EPS>
|
||||
</Values>
|
||||
<Values MinimumVersion="8">
|
||||
<Rectangle TargetInterfaceChangeCount="" LastUpdatedInterfaceChangeCount="">
|
||||
<ObjectExportOption SpaceUnit="CssPixel" CustomLayout="false" CustomLayoutType="AlignmentAndSpacing" />
|
||||
@@ -185,6 +205,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
<ActualMetadataProperty NamespacePrefix="$ID/" PropertyPath="$ID/" />
|
||||
</Properties>
|
||||
</ObjectExportOption>
|
||||
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
|
||||
</Oval>
|
||||
<Polygon HorizontalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" VerticalLayoutConstraints="FlexibleDimension FixedDimension FlexibleDimension" TargetInterfaceChangeCount="" LastUpdatedInterfaceChangeCount="">
|
||||
<ObjectExportOption CustomAltText="$ID/" ImageConversionType="JPEG" ImageExportResolution="Ppi300" GIFOptionsPalette="AdaptivePalette" GIFOptionsInterlaced="true" JPEGOptionsQuality="High" JPEGOptionsFormat="BaselineEncoding" ImageAlignment="AlignLeft" ImageSpaceBefore="0" ImageSpaceAfter="0" UseImagePageBreak="false" ImagePageBreak="PageBreakBefore" CustomImageAlignment="false" SpaceUnit="CssPixel" CustomLayout="false" CustomLayoutType="AlignmentAndSpacing">
|
||||
@@ -313,6 +334,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
</Properties>
|
||||
</EndnoteOption>
|
||||
</Document>
|
||||
<XmlStory IsEndnoteStory="false" />
|
||||
<Preferences>
|
||||
<TextDefault ParagraphBorderOverprint="false" ParagraphBorderGapOverprint="false" ParagraphBorderGapTint="-1" ParagraphBorderStrokeEndCap="ButtEndCap" ParagraphBorderStrokeEndJoin="MiterEndJoin" ParagraphBorderTopLeftCornerOption="None" ParagraphBorderTopRightCornerOption="None" ParagraphBorderBottomLeftCornerOption="None" ParagraphBorderBottomRightCornerOption="None" ParagraphBorderWidth="ColumnWidth" ParagraphBorderRightOffset="0" ParagraphBorderDisplayIfSplits="false" ProviderHyphenationStyle="HyphAll">
|
||||
<Properties>
|
||||
@@ -386,6 +408,10 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
|
||||
<ParagraphStyle EmitCss="true" />
|
||||
<CharacterStyle SplitDocument="false" EmitCss="true" />
|
||||
</WhenWritten>
|
||||
<WhenWritten MinimumVersion="11">
|
||||
<Story UserText="true" />
|
||||
<XmlStory UserText="true" />
|
||||
</WhenWritten>
|
||||
<WhenWritten MinimumVersion="13">
|
||||
<TextFrame>
|
||||
<TextFramePreference FootnotesEnableOverrides="false" FootnotesSpanAcrossColumns="false" />
|
||||
|
||||
+4
-8
@@ -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);
|
||||
|
||||
+12
-10
@@ -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
|
||||
|
||||
+7
-7
@@ -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,
|
||||
|
||||
+23
-22
@@ -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
|
||||
|
||||
+9
-1
@@ -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<bool>,
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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/<tag>". 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"],
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user