7 Commits
Author SHA1 Message Date
aiongg b5761b3333 feat: write the footnote separator tab without the footnote chunk, and record the endnote separator exceptions 2026-10-12 10:20:33 +00:00
aiongg a299387eb0 feat: decode page item, preference and resource values
Page items:
- drop shadow KnockedOut (0x1EB6F), true where neither item nor style
  stores it
- text wrap: the u32 at 40 of 0x3703 is the master page flag and the
  wrap side (two u16, as the big-endian pair shows)
- groups get the fill, stroke and corner values all their children have
- dashes (0x5A35: list and corner code) on items whose stroke type in
  effect is Dashed
- BeforeGroupingLayerPosition (0x324) from 21.4; export SizeType
  (0x1E22B); no generated alt text attributes on groups
- anchored settings on items inside anchored items
- IgnoreWrap false without the chunk, MinimumFirstBaselineOffset 0 by
  the baseline category, InsetSpacing before DOM 11 by the general
  category; EPS contents from 0x8C23
- custom striped and dashed stroke styles (classes 0xB016, 0x5A43) and
  StrokeType code 0x5A42

Preferences: column direction (0x555, else the story orientation),
optical margin size by the text size unit, highlight flags false without
their chunk, grid and gutter defaults and print marks by the edition
code, watermark font by the assignment name, EPUB ViewDocumentAfterExport
for DOM 8 and 9, HTMLFXLExportPreference from DOM 10.1, MathML document
values from DOM 20, index header type by variant name, three more
built-in kinsoku and mojikumi tables.

Resources and text: the saving edition from the XMP black name (tints
of black, unknown users, endnote and index titles, endnote marker), TOC
style entries, PageNumberType (0x1B09), CustomGlyph (0x1B5E), alignment
codes of 0x4266, 0x1B3E and 0xB676, spot colour alias and DOM 8 section
pagination (observed values), text variable settings and result texts,
object styles' AppliedParagraphStyle without a chunk and flex spacing,
stories of frames anchored in the XML backing story.

Fixes: flattener resolutions of 0x10833 were swapped; colour group Self
follows the DOM version.

compare.py, trustworthy pairs: value coverage 98.96 % -> 99.48 %
(+150,288 values), documents >= 99 % 914 -> 1,021, story text 37,129 ->
37,147 of 37,150 (0 missing), extras 92,838 -> 92,883 (+788 from the
KnockedOut and group-corner exceptions, -744 from fixed extras). No pair
loses values against f21267f. diff_outputs.py: 5,743 of 5,765 outputs
differ, no failure or warning differs.
2026-10-10 18:34:10 +00:00
aiongg d34092793e feat: read more preference chunks and write the values of files without them
Chunks of the preferences object: the story settings of new frames
(0x2EE) and the story orientation (byte 116 of 0x280), the text wrap of
new page items (0x3720), DocumentGridShown (0x566),
EnableStylePreviewMode (0xCAF3), three highlight flags (0xCA62, 0xCAD3,
0xCAD4), four layout grid flags (0xCD14, 0xCD1C to 0xCD1E),
MojikumiUiSettings (0x42DB), the tagged PDF structure order and
dictionary recomposition (0x11C69), CreateLinkToXML (0x1BC0B), the
pasteboard theme colour flag (byte 32 of 0x5D2), and the footnote
EosPlacement and minimum first baseline offset (0x2820).

Where every file without a chunk has one value, the converter writes it:
anchored object, story and text wrap settings, footnote options,
index options, chapter numbering, booklet margins, layout adjustment,
smart text reflow flags. TaggedPDFPreference is written from 7.5.
Evidence in preferences.md and footnotes.md.

compare.py --exclude own/, trustworthy pairs, with the two commits
before: 98.51 % -> 98.74 % (+67,661 values, 0 lost on any key), e.g.
MojikumiUiPreference and TaggedPDFPreference elements 0 -> 1,251 and
1,242, ChapterNumberPreference 73 -> 1,251, IndexOptions 66 -> 1,251
per attribute. Extra values unchanged (93,502). The text range count
in d7bc060 is 1,605, not 1,562.
2026-10-10 09:05:25 +00:00
aiongg 8ce6c388e7 feat: write the frame baseline grid and footnote options and the document frame defaults
Text frames get BaselineFrameGridOption from chunk 0x2834 of their
multi-column frame, and TextFrameFootnoteOptionsObject from DOM 12, both
by the category rule of TextFramePreference (all values when the
category is off or the frame has no style, else the values that differ
from the style's). FootnotesSpanAcrossColumns comes from chunk 0x22608
u16 at 2. Frames without chunk 0x2CE, or with the 22-byte chunk of 7.0,
now get their TextFramePreference. Object styles write their baseline
grid from chunk 0x1B924 at 82 (code 1 is TopOfMargin). The document's
TextFramePreference reads the column rule and footnote values of the
preferences chunks 0x22646 and 0x22608.

The 13.1 boundary of the Footnotes... values and of
MergeConsecutiveParaBorders counts as reached when the header or the
last session of the save history is 13.1: 109 pairs whose header says
13.0 have them, 93 of which a 13.1 session saved last. Evidence and
re-checked counts in objects.md, footnotes.md and idml-values.md.

compare.py --exclude own/, trustworthy pairs: +48,405 values (+43,158
for the elements, +5,247 for the 13.1 rule), 0 lost on any key.
TextFrameFootnoteOptionsObject 17,002 -> 20,096 of 20,096 on written
frames; BaselineFrameGridOption 0 -> 1,961 of 1,961; TextFramePreference
elements 48,038 -> 48,708; document column rule 0 -> 576 of 576.
Extras: the 82 FootnotesSpanAcrossColumns values are gone, 3
EnableOverrides values are new.
2026-10-10 03:01:34 +00:00
aiongg 0c560ea96b feat: write the values that follow the language of the last session
Decode the save history of the document (chunk 0x1D8): one record per
session, with a u16 language code. The layout parses 4,431 of the
4,439 distinct valid corpus files (not the six InDesign 2.x files and
two without the chunk) and all 803 pairs. Code 0x0101 in the last
record marks a session of a Japanese or Chinese edition: all 149
Japanese pairs have it.

The converter uses it for values that IDML writes in the exporting
InDesign's language:

- spread FlattenerPreference without chunk 0x10833: 400/400 for
  0x0101, otherwise 300/150, none when the history cannot be read
  (7,481 of 7,490 spreads of all pairs; the 9 others are one pair
  exported in a session the INDD does not record)
- IndexOptions without chunk 0x13010: BetweenEntriesSeparator "、" or
  "; " (789 of 791 pairs) and Title "索引" for 0x0101 (158 of 159);
  no title for other codes, whose titles vary by language
- EndnoteOption without chunk 0x2261E: separator U+3000 and
  RubyMarker for 0x0101, tab and SuperscriptMarker otherwise (140 of
  141)

The endnote title and the Assignment Name do not follow the code and
stay out (objects.md, save history, has the counts).

compare.py --exclude own/:
- trustworthy coverage 97.71% -> 97.72% (+1,119 values: flattener
  resolutions 5,065 -> 5,404 of 5,413 each, index title 10 -> 136,
  separator 481 -> 604 of 606, endnote separator and marker position
  301 -> 397 of 398)
- all pairs 95.88% -> 95.89% (+1,679)
- extra values unchanged (26,256; all pairs 304,533)
- compare.py --all with schemas: 0 conversion and 0 schema failures
  on pairs
2026-10-08 13:34:24 +00:00
aiongg 76069876a4 feat: write TextFrameFootnoteOptionsObject from DOM 14
From DOM 14 IDML repeats a frame's footnote options as
TextFrameFootnoteOptionsObject on the frames whose TextFramePreference
has FootnotesEnableOverrides. The converter writes it on those frames,
with the values of that preference.

Trustworthy pairs: reproduced 10,650,374 -> 10,669,264 (92.54 % ->
92.71 %); 3,778 elements with all four values, no extra value (26,107).
No key reproduces fewer values. Schema validation: 0 failures.
2026-10-08 03:08:46 +00:00
aiongg 649e80ea6f feat: write footnotes, endnotes and their options
- Footnotes: text owned by a footnote (class 0x24F) is read into the
  footnote and written as a Footnote element in place of its U+0004;
  hyperlink sources inside footnotes are placed like the others.
- FootnoteOption from preferences chunk 0x2820 (styles, numbering,
  marker, spacing, strings, splitting, straddling, both rules); without
  the chunk, the text style and straddling every IDML has. The value
  file reader decodes numeric character references, which fixes the
  SeparatorText tab.
- EndnoteOption from chunk 0x2261E; default marker and text styles
  without it. IsEndnoteStory from DOM 13 instead of 15.
- Endnotes: the endnote story (class 0x2801) is converted, references
  (class 0x2805) become Endnote elements, ranges (class 0x2804, in the
  range tree) EndnoteRange, and its frames EndnoteTextFrame, as InDesign
  writes them.
- compare.py accepts the schema errors of that endnote markup when the
  reference IDML of the pair has the same errors (docs/measurement.md).

Trustworthy pairs: reproduced 10,579,111 -> 10,650,374 (91.92 % ->
92.54 %); stories with identical text 18,565 -> 18,574 (0 missing);
documents >= 99 % 20 -> 21; TextRange +62,059, FootnoteOption and
IsEndnoteStory complete, EndnoteOption +1,356, hyperlinks in footnotes
+271. Extra values 26,179 -> 26,107. No key reproduces fewer values.
Schema validation: 0 failures; 1 pair accepted by the endnote rule; 11
files without a reference fail only on endnote markup.
2026-10-08 02:56:03 +00:00