Commit Graph
15 Commits
Author SHA1 Message Date
aiongg e0e1f99b7a feat: read the export options and language quotes, and write values of the exporting edition
Decoded chunks:
- EPUB (0x21A1A), HTML (0x21A19), fixed layout EPUB (0x21A25) and
  Publish Online (0x21A20) export options; the EPUB chunk is read in the
  layout of its two variable blocks that ends at the chunk's end. Files
  without a chunk get the values every such file has.
- Adjust layout (0x7020): EnableAdjustLayout,
  AllowFontSizeAndLeadingAdjustment, EnableAutoAdjustMargins.
- Language quotes (0x2D26), and $ID/ for an empty vendor of a language
  whose vendor is never stored; Romanian quotes without the chunk.

Values without a field follow the InDesign that exported the IDML,
taken from the save history or the edition that made the document (the
language of its assignment name); preferences.md lists the rules and
their exceptions: DOMVersion by the last session's release, Publish
Online resolution and PublishPdf, EnableAdjustLayout after 14.0.0 and
14.0.1, the index title and separator, SnapZone, BaselineFrameGridColor
and ColumnGuideColor by the last session's language code, and style
shortcut key codes by its platform (also on character styles of DOM 7
to 12, which got none).

compare.py --exclude own/, trustworthy pairs: 98.74 % -> 98.96 %
together with the three commits before (+62,457 values, 0 lost on any
key); e.g. EPubExportPreference 0 -> 1,242 per attribute, DOMVersion
668 -> 1,164 of 1,251, IndexOptions Title 284 -> 1,162, SnapZone 68 ->
1,240, Language HyphenationVendor 1,945 -> 2,818 of 2,829,
BaselineFrameGridColor 934 -> 1,154 (object styles 4,163 -> 5,136),
ColumnGuideColor 406 -> 1,228, CharacterStyle KeyboardShortcut 2,547 ->
3,154 of 3,154. Extra values 93,502 -> 92,838: +346 on Language
elements the reference IDML leaves out (their new vendors and quotes),
one PublishPdf of an IDML exported by another release.
2026-10-10 09:40:07 +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 d7bc060fd4 feat: read eleven more text attributes and the page item default angles and scales
Text attribute IDs that every text default list has, with styles and
runs: KeepFirstLines (0x1B3A), KeepLastLines (0x1B3B),
AllowArbitraryHyphenation (0x42C1), GridGyoudori (0x4264),
RotateSingleByteCharacters (0x4268), AutoTcy (0x4261),
ScaleAffectsLineHeight (0x42A3), ParagraphShadingOverprint (0x1BD4),
ParagraphBorderType (0x1BFD, a stroke type), RubyFont (0x4233) and
KentenFillColor (0x4257). The root style values for them are dropped
from root_values.xml, which keeps only values the converter does not
read.

PageItemDefault gets GradientFillAngle, GradientStrokeAngle,
Nonprinting and the two arrowhead scales from the page item defaults
list, and the line end code 0x5A0C is SquareSolidArrowHead. Evidence
in attributes.md and preferences.md.

compare.py --exclude own/, trustworthy pairs: +15,104 values for the
text attributes (TextDefault 1,251 of 1,251 for each, paragraph and
character styles and 1,562 text ranges), +5,737 for PageItemDefault
(RightLineEnd 1,247 -> 1,251 of 1,251); 0 lost, no extra value.
2026-10-10 09:05:14 +00:00
aiongg 1a2ce02c4f feat: read anchored object settings field by field
Chunk 0x2800 has one u16 per attribute: AnchoredPosition at 40,
HorizontalReferencePoint at 42, VerticalReferencePoint at 44, AnchorPoint
from 46 and 50, HorizontalAlignment at 48, VerticalAlignment at 52,
SpineRelative at 54 and PinPosition at 56, with the two offsets at 0 and
16. The grouped tables written before were the combinations the smaller
corpus showed. Every field matches the 6,363 object styles, 1,076
anchored items and 1,295 preference chunks of the corpus.

An anchored item gets every value when its object style turns the
anchored object category off (670 items, with LockPosition and
AnchorSpaceAbove from the value files), else the values that differ
from the style's. Preferences and object styles without the chunk get
the values every such file has.

compare.py --exclude own/, trustworthy pairs: 98.46 % -> 98.51 %
(+11,653 values, 0 lost on any key); ObjectStyle SpineRelative
2,031 -> 5,556 of 5,556, preference SpineRelative 0 -> 1,251 of 1,251,
anchored text frames, rectangles, ovals, polygons, lines and groups
gain their settings (TextFrame PinPosition 2 -> 556 of 556). Extra
values unchanged (93,502).
2026-10-10 09:04:37 +00:00
aiongg 8e4d67b9f4 feat: read the 126-byte document setup of InDesign 7.0 and 7.5
The chunk has 16 bytes before the page size, and its fields from the
facing pages flag on are 20 bytes earlier than in the 146-byte chunk.
The page size, facing pages, intent, binding, bleeds and slugs match
the IDML in 11 of 11 pairs.

compare.py (trustworthy pairs): 135 more DocumentPreference values in
9 documents (15 attributes each), no extra value; the warning
"document preferences of 126 bytes are not known" is gone.
2026-10-10 07:24:32 +00:00
aiongg 01261ba47a feat: decode frame fitting, object style overprint, style IDs and export settings
- Frame fitting: AutoFit 1 (true), FittingAlignment 1 (TopCenterAnchor)
  and 3 (LeftCenterAnchor). A rectangle, oval or polygon whose object
  style turns the fitting category off (0x1B960 not in chunk 0x1B92E)
  gets all seven attributes, the item's or the style's; this holds for
  the root [None] too (22 trustworthy documents, 9,560 items; none in
  the 883 others). A style with the category on writes only the item's
  values that differ. The preference FrameFittingOption writes all seven,
  0 or code 0 where the page item defaults list lacks one (1,251 of
  1,251 pairs each).
- Object style OverprintFill, OverprintStroke and OverprintGap (0x6E6A,
  0x6E67, 0x6E8B) where the colour carries ink (not None, Paper, tint 0
  or a white process colour), on every style from 21.4.
- StyleUniqueId on every paragraph and character style when 11.2 saved
  the document: the GUID after the name's string (GUID form only), else
  $ID/. A 36-character style name is no longer taken for the GUID.
- Chunk 0x28F0 parsed with its export tag maps: SplitDocument, EmitCss
  (10.1 on) and IncludeClass (13.0 on) on every text style, root styles
  and styles with tag maps included, EmitCss and IncludeClass on object
  styles; StyleExportTagMap elements. The WhenWritten values of these
  attributes are dropped from element_values.xml.

Evidence in objects.md, preferences.md and idml-values.md.

compare.py --exclude own/, trustworthy pairs: 97.60 % -> 97.84 %
(+71,229 values, 0 lost on any key); Oval/Polygon/Rectangle
FrameFittingOption AutoFit 32,300 -> 44,868 of 44,868, preference
FrameFittingOption 1,251 of 1,251 per attribute, StyleUniqueId 6,424 ->
10,047 of 10,051, ObjectStyle OverprintStroke 0 -> 1,512 of 1,512,
StyleExportTagMap 0 -> 306 of 306 elements, export flags of every
style. Extras 94,157 -> 93,569: 444 FrameFittingOption elements and 168
SplitDocument and EmitCss values gone; 24 StyleUniqueId values are new,
in five 11.4 pairs whose IDML was exported by 11.0.
2026-10-10 05:47:49 +00:00
aiongg 5ee17cb100 feat: write the baseline frame grid colour and two text preferences
Write TextPreference UseCidMojikumi and UseNewVerticalScaling from
bytes 168 and 170 of preferences chunk 0x280 when they are equal (803
of 803 pairs). Write BaselineFrameGridColor in the preferences and in
every object style by an observed rule over stored data: the interface
colour of chunk 0x2834 (u32 at 20) when not 0, otherwise Charcoal if
byte 168 of chunk 0x280 is 1 and LightBlue if it is 0 (803 of 803
pairs). Evidence in preferences.md.

compare.py --exclude own/, trustworthy pairs: coverage 98.15 % ->
98.16 % (wrong values fixed: object style colours 581, preference
colour 132, UseCidMojikumi and UseNewVerticalScaling 129 each),
documents >= 99 % 184 -> 187; all pairs 96.29 % -> 96.30 %. Extras
unchanged (8,968), no new failures or warnings, schema failures 0 on
pairs.

diff_outputs.py: 4,077 outputs differ, only in Resources/Preferences.xml
and Resources/Styles.xml: the two text preferences now come from the
INDD (order of attributes; values change where byte 168 is 1), and the
colour changes where the rule gives Charcoal.
2026-10-08 17:38: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 f0bd7f1e3b feat: decode default styles, grids, guide colours and other preferences
From the preferences object:
- TextDefault AppliedParagraphStyle and AppliedCharacterStyle (chunks
  0x28D4, 0x28D5); PageItemDefault graphic, text and grid object styles
  (chunk 0x1B959).
- LayoutGridDataInformation and StoryGridDataInformation (chunks 0xCD2F,
  0xCD2E): font, font style, sizes, akis, scales, character count size.
- MasterTextFrame and CreatePrimaryTextFrame (chunk 0x59C),
  BlendingSpace (0x1081F), AllowPageShuffle, GuidesShown, snapping,
  GuidesInBack, BaselineGridRelativeOption, ZeroPoint, layout
  adjustment, ShowTextThreads (from version 21.1), AbutTextToTextWrap
  and HonourTextIndentsWithTextWrap.
- Interface colours of guides, grids, margins, columns and the
  pasteboard, with four more named colours (LightGray, GridBlue, Peach,
  Burgundy).
Node::merge no longer adds observed text or children to a typed value,
so a colour list is not merged with an observed colour name.

compare.py --exclude own/:
- trustworthy value coverage 97.42% -> 97.48% (+6,332 values); all
  pairs 95.41% -> 95.46% (+8,463)
- extra values: trustworthy unchanged; all pairs +1 (ShowTextThreads in
  one pair whose IDML is from an earlier version)
- compare.py --all with schemas: 0 schema failures on pairs; files
  without a reference as before
2026-10-08 07:00:27 +00:00
aiongg 450fd1f5ac feat: decode the index, chapter, dictionary and EPUB preferences
- IndexHeaderSetting (chunk 0x1300E): its five attributes and the whole
  Properties/ListOfIndexHeaderGroup tree.
- IndexOptions (chunk 0x13010): title, title and level styles,
  separators and flags. Styles are matched by name among the styles
  outside groups. Without the chunk no Title is written: it follows the
  exporting application's language.
- ChapterNumberPreference (chunk 0x1A4C4): format, source, number.
- DictionaryPreference Composition: UseDocument with chunk 0x2806,
  Both without.
- EPubExportPreference (DOM 8 on): Version and Id from chunk 0x21A1A;
  without it the observed Id, TocStyleName $ID/, and Version Epub3
  from INDD version 18.1.

compare.py --exclude own/:
- trustworthy value coverage 97.15% -> 97.17% (+2,465 values); all
  pairs 95.19% -> 95.21% (+3,281)
- ListOfIndexHeaderGroup 489 of 489; IndexOptions Title 10 of 10 with
  the chunk; Composition wrong in 5 documents (Both with the chunk);
  TocStyleName with the chunk is not written (13)
- extra values unchanged; no key lost values; 0 failures
- compare.py --all with schemas: 0 schema failures on pairs; the files
  without a reference fail as before (22 conversions, 11 schemas)
2026-10-08 05:45:37 +00:00
aiongg c6e943e187 feat: decode the whole print settings chunks and booklet margins
Chunks 0xA4C and 0xAF2 are read to their end: device type, paper
offset range, colour output, screening, scaling, tiling and thumbnails,
graphics and font download, printer marks, bleed, slug, profile, ink
screens, flattener preset and the paper size selector. AllPrinterMarks
and PreserveColorNumbers are derived from them. Printer and PPD follow
the corrected rules (built-in empty printer, device-independent PPD
only for PostScript file output). Chunk 0xAF0 gives the four
PrintBookletOption margins. Booklets leave out the attributes their
element does not have.

compare.py --exclude own/ (trustworthy pairs):
- value coverage 96.85% -> 97.03% (+21,049 values; all pairs
  94.89% -> 95.07%, +28,090)
- PrintPreference and PrintBookletPrintPreference: every attribute
  reproduced in all 489 pairs except PreserveColorNumbers (2) and
  MarkType (1); PrintBookletOption margins 11 -> 0 documents wrong
- extra values unchanged; no key lost values; 0 failures
2026-10-08 05:13:12 +00:00
aiongg 8b0f46837b feat: write unnamed colours and gradients only when something refers to them
IDML writes a colour or gradient without a name only if a value in the
package refers to it, a gradient stop or tint uses the colour, or the
page item defaults name it in one of the two entry tables of chunk
0x6E07 (objects.md, colours; preferences.md). The graphic part is now
written last, from the references in the other parts; the second table
of chunk 0x6E07 is read.

compare.py, trustworthy pairs: extra values 155,956 -> 33,181 (unnamed
Color -114,734, Gradient -3,498, GradientStop -4,543). 463 values are
no longer reproduced: 10 unnamed colours and 22 unnamed gradients with
their stops that IDML writes though nothing refers to them (open, see
objects.md). Value coverage 92.46 % -> 92.45 %. No conversion or schema
failures; story text 18,509/18,610.

The previous commit (09e87fa), measured alone: extra values 635,511 ->
155,956, value coverage 92.41 % -> 92.46 %; 39 values lost (7 opacity
stops and 8 drop shadows IDML writes with values equal to the style,
5 StrokeWeight, 1 TextColumnFixedWidth).
2026-10-07 22:33:58 +00:00
aiongg 8d71e09a6b feat: read the start of the print and booklet print settings 2026-10-07 18:07:03 +00:00
aiongg 1e26e1e8bd feat: read text, margin, anchor, pasteboard, XML tag and page item defaults 2026-10-07 15:40:54 +00:00
aiongg 8e8cb28d40 feat: read colour settings, view, grid, watermark and text defaults from the preferences 2026-10-07 15:14:54 +00:00