Commit Graph
32 Commits
Author SHA1 Message Date
aiongg 09e87fadea feat: write page item values only where they differ from the object style
IDML leaves out the values of a page item that equal those of its
applied object style. The writer now compares with the style's
effective values (its own, then the styles it is based on, then [None]):

- TextFramePreference: an attribute is written when its category is off
  in the style's category list (chunk 0x1B92E, also for [None]) or its
  value differs; TextColumnMaxWidth (DOM 8), TextColumnCount (DOM 10)
  and InsetSpacing (DOM 11) are always written; footnote values from
  13.1 (objects.md, text frame preferences).
- Fill, stroke, miter and corner attributes (attributes.md).
- Transparency effects: only differing values, and an effect element
  only when it has one or its opacity stops differ (transparency.md).

New decoding: object style chunk 0x1B924 fields for balance, fixed
width, justification, first baseline offset (code 4 = XHeight, also for
frames) and auto-sizing; chunk 0x1B92C (style transparency). Object
styles get the DOM 12 text frame values from DOM 8 and
FootnotesEnableOverrides from 13.1 (idml-values.md).
2026-10-07 22:19:20 +00:00
aiongg 17c6ace935 feat: leave out values IDML does not write (layers, root styles, version gates)
Rules from the corpus, each documented in docs/format/:

- ItemLayer only on items directly under a spread (objects.md).
- The root object style [None] gets no Enable… attributes and no effects
  category settings; EnableTextFrameColumnRuleOptions from 15.1, and the
  footnote values of an object style's TextFramePreference from 13.1.
- The root paragraph style has no NextStyle and no AllNestedStyles;
  TextDefault has AllNestedStyles only when the list has items; the
  empty TabList is written from DOM 8 (attributes.md).
- DOM 7 has no EPubExportPreference or HTMLExportPreference.
- Row and column Self use a hexadecimal index (tables.md).
- Cell CellType from DOM 11; Document Name from DOM 13; ColorGroup Self
  is the UID before 11.3.
- The internal layer is the first of the document's layer list, whatever
  its name.
- A CR in a name is %0d in Self (colours, gradients, tints, hyperlink
  destinations, styles).

compare.py, trustworthy pairs (after the compare fix of 48d184f):
extra values 705,523 -> 635,511; value coverage 92.25 % -> 92.41 %
(10,296,599 values); 2 ItemLayer values lost (the 2 grouped items whose
IDML has one); 12 documents >= 99 %. No conversion or schema failures.
2026-10-07 22:01:28 +00:00
aiongg 5b7e0ecf1f feat: write link attributes and placed graphic settings
Links: LinkResourceModified, ShowInUI, LinkImportStamp and the two link
times from chunk 0x8C9B, PDFIdentifier from chunk 0x1B6, the size and
format name from the resource's chunk 0x8C92, and the values every link
has. Link times are written in the time zone of the XMP date nearest in
day of the year (the INDD has no time zone; compare.py does not score
them): 3,886 of 4,446 import times and 3,316 of 4,434 modification
times right.

Images, PDF, EPS and SVG graphics: the page item settings and object
style, Space, ActualPpi and EffectivePpi (chunk 0x1708 and the scale on
the spread), ImageTypeName, Profile (chunk 0x7C0F), fill colour and
gradients, vector colour policies (chunk 0x7C42 or the document's
policies), PDFAttribute (chunk 0x251B), GraphicLayerOption with the
GraphicLayer tree (chunk 0x177A) and LayerCompOption (chunk 0x9209),
and ImageIOPreference from chunk 0x1714 in place of chunk 0x8C39.
The placed graphic writer moves to idml/graphic.rs.

compare.py --all --exclude own/ (trustworthy pairs): value coverage
90.00% -> 91.61% (+179,834 values); documents >= 99 %: 1 -> 5; median
94.2% -> 95.7%; no key lower. Extra values 709,643 -> 709,654 (+11 in
SVG elements that are not in the reference). New warnings: 178 layer
chunks in 3 InDesign 3.0 files, whose layout differs, are left out.
0 conversion and 0 schema failures.
2026-10-07 21:13:31 +00:00
aiongg 9de24aa28f feat: read object export options of page items (chunk 0x1E206)
ObjectExportOption now takes its alternative text, actual text and
tagging values from chunk 0x1E206 of the item, and its other attributes
from a table by INDD major and minor version (8.0-9.1, 9.2, 10.0, 10.1
on, 21.0, 21.1, 21.4), for page items from version 8 and for every
object style, [None] included, from version 9. Page items of version 7
get no ObjectExportOption, as in their IDML.

compare.py --all --exclude own/ (trustworthy pairs): value coverage
88.72% -> 90.00% (+142,324 values); documents >= 99 %: 0 -> 1; median
92.4% -> 94.2%; no key lower. Extra values 713,688 -> 709,643: -4,319
from the DOM 7 rectangles that no longer get the element; +274 more
values in GraphicLine, Oval and TextFrame elements that are not in the
reference (more attributes per element). 0 conversion and 0 schema
failures.
2026-10-07 20:51:44 +00:00
aiongg 50638a4760 fix: write 17-digit numbers rounded to the nearest, ties to even
IDML writes the shortest decimal that reads back as the same value; when
that needs 17 digits it takes the 17-digit decimal nearest to the exact
value, with ties to even (150.23599243164062). Rust's shortest form can
end in the other digit (…063). num() now re-rounds 17-digit output with
{:.16e}.

compare.py --all --exclude own/ (trustworthy pairs): value coverage
88.72% (9,885,604 -> 9,885,761 values); PDF P.GraphicBounds +148,
EPS P.GraphicBounds +9; no key lower; extra values unchanged (713,688);
0 conversion and 0 schema failures.
2026-10-07 20:37:04 +00:00
aiongg 3da31dc6c2 feat: write style keyboard shortcuts and empty nested, line and GREP style flags 2026-10-07 16:05:18 +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
aiongg deebe0e8a7 feat: write the constant shade every document lists
The pasted smooth shade object of lowest UID with a constant shading
becomes a PastedSmoothShade whose contents are its numbers in big-endian
order, with the values every constant shade has in IDML.

Value coverage on trustworthy pairs: 87.08 % to 87.13 %.
2026-10-07 14:19:32 +00:00
aiongg 3f1f10799d feat: write the InCopy assignment of every document
Each assignment object becomes an Assignment with the values every IDML
has. Its name depends on the language of the computer that exported the
IDML, so it is left out of the output and of value coverage.

Value coverage on trustworthy pairs: 86.83 % to 86.86 %.
2026-10-07 13:45:28 +00:00
aiongg 27cfef8fd7 feat: write named grids and object style export options
designmap.xml gets the document's named grids with the layout grid
settings all its pages share. Object styles other than [None] get the
export options every IDML of their version has, now also before
InDesign 12.

Value coverage on trustworthy pairs: 86.72 % to 86.83 %.
2026-10-07 13:29:58 +00:00
aiongg 2d52b399c4 feat: write table of contents styles and the stories they made
Styles.xml gets a TOCStyle for each TOC style object, with its name,
title, title style and numbering, anchor and line break settings, and
stories get AppliedTOCStyle through the table of contents object that
made them. Entries are not decoded yet.

Value coverage on trustworthy pairs: 84.29 % to 84.50 %.
2026-10-07 12:41:09 +00:00
aiongg e6dd2d629f feat: write style import flags, unique IDs and common style values
Paragraph and character styles get Imported (the u16 after the style
kind) and StyleUniqueId (the GUID after the name) from the INDD, and the
values every non-root style has in IDML, such as PreviewColor, from
observation. The values generator leaves root styles out of the style
paths.

Value coverage on trustworthy pairs: 84.07 % to 84.29 %.
2026-10-07 12:14:48 +00:00
aiongg 463fef540a feat: write swatch library, alternate colour and guide settings
Colours get SwatchCreatorID and their alternate colour from the INDD,
HSB colours are written as RGB with ConvertToHsb, and every swatch names
its colour group swatch from DOM 12 on. Guides get Locked, GuideZone,
OverriddenPageItemProps and PageIndex, which counts pages from the
spine. Tints, gradients and the None swatch get the values every IDML
has on them.

Value coverage on trustworthy pairs: 83.37 % to 84.07 %.
2026-10-07 11:54:33 +00:00
aiongg 09782f6af0 feat: write more text frame settings
TextFramePreference gets the maximum column width, fixed column width,
auto-sizing minimums, text wrap override, column rule width and colour,
footnote spacings and the inset spacing (from the frame), read from
their chunks. Attributes that IDML writes only on some frames, with one
value wherever it does, are generated as WhenWritten values and also
give the versions from which column rules and footnotes exist.

Value coverage on trustworthy pairs: 82.03 % to 83.37 %.
2026-10-07 11:34:20 +00:00
aiongg 722fddfe97 feat: write languages, document users and document settings
designmap.xml gets the document's languages from their INDD objects,
with the quotes every IDML gives each language, the document users from
the document object, and the settings elements every IDML of the version
has (watermark, linked story and page item options, footnote and
endnote options and others) with their common values. User colours are
set by the exporting InDesign, not the INDD, and are left out of value
coverage.

Value coverage on trustworthy pairs: 81.65 % to 82.03 %.
2026-10-07 11:08:03 +00:00
aiongg fbe1e7f6ca feat: write spread, page, section and layer settings
Spreads get AllowPageShuffle and their FlattenerPreference, master
spreads ShowMasterItems, pages their tab order, overrides, layout grid
use, layout rule, colour, alternate layout and numbering descriptor,
sections their prefix, marker and alternate layout, and layers their
printing, guide, UI, wrap and colour settings. Interface colours are
named from one table shared with XML tags. Values every IDML has on
these elements, and the two built-in trap presets, are written from
observation.

Value coverage on trustworthy pairs: 80.03 % to 81.65 %.
2026-10-07 10:45:11 +00:00
aiongg 3d968bea8a feat: write the settings every page item has
Page items get Name, Visible, Locked, the interface change counts,
OverriddenPageItemProps, the layout constraints and the gradient angles
and highlights, read from their chunks and attribute lists, with the IDML
defaults where a chunk is absent. Groups take the gradient values their
children share. tools/element_values.py collects the values every IDML
of a version has on an element; the converter writes those of page items
and their export options, now for every version.

Value coverage on trustworthy pairs: 62.62 % to 80.03 %.
2026-10-07 10:09:02 +00:00
aiongg c9528b10ff feat(tools): list reproduced values per key and dump whole chunks
compare.py writes values.tsv and values-all.tsv with every key's values and
how many are reproduced, so a change can be checked for keys that lose
reproduced values. indd dump --full prints every byte of each chunk.
root_values.py reads the current inventory layout and keeps to the pairs
its generated files were made from.
2026-10-07 09:39:02 +00:00
aiongg 4bc6768fb0 feat: write vertical story orientation
A text frame's multi-column frame stores a matrix (chunk 0x2DE) that is
the identity for horizontal text and a quarter turn for vertical text.
A story whose frames all have the quarter turn is written Vertical
instead of the Horizontal every sample's IDML has.
2026-10-07 04:27:07 +00:00
aiongg 9fef3b0516 feat: read the page binding
DocumentPreference PageBinding comes from the document preferences
(u16 at 64) instead of the value every sample's IDML has. A vertically
typeset sample bound on the right stores 1, RightToLeft.
2026-10-07 04:25:39 +00:00
aiongg 44c85c5a54 feat: write export options of page items
Every page item in the corpus IDML files from DOM 12 on has the same
ObjectExportOption, and every rectangle, oval and polygon the same
InCopyExportOption. Write them from that observation.
2026-10-07 01:41:55 +00:00
aiongg 32c74f5c6b feat: convert inks and colour groups
Write an Ink for each ink object (class 0x1F07) with its neutral
density, trap order, frequency and angle, and the colour groups listed
in the preferences (chunk 0x1F61) with their swatches.
2026-10-07 01:41:10 +00:00
aiongg 9eba4eea66 feat: convert composite fonts, kinsoku tables and mojikumi tables
Read the composite font and its entries (classes 0xCB02 and 0xCB03):
name, font, style and custom characters, and the kinsoku and mojikumi
tables with the character lists of a custom kinsoku table.
2026-10-07 01:40:31 +00:00
aiongg 3f4a68dfe6 feat: write object style settings for every object style
Object styles other than [None] now get their text frame, story, text
wrap and frame fitting settings, fill, stroke and corner attributes,
applied paragraph style and some category flags from the INDD (chunks
0x1B92B, 0x1B924, 0x285B, 0x50F28, 0x3776, 0x3777, 0x1B92E, 0x1B946),
and the values every such style has in the corpus IDML files, collected
by tools/root_values.py into src/idml/object_style_values.xml. The root
style gets the same INDD values in place of observed ones.
2026-10-07 01:33:21 +00:00
aiongg 4ff4dd03e0 feat: convert frame fitting and clipping path settings
Frame fitting attributes are in the page item attribute list and, for
object styles, in chunk 0x1B956. Write FrameFittingOption on rectangles,
ovals, polygons and object styles, ClippingPathSettings on images, PDF
and EPS graphics from chunk 0x2C1A, and ImageIOPreference on images from
chunk 0x8C39.
2026-10-07 01:26:02 +00:00
aiongg 2694a9ea43 feat: write story preferences and story values every IDML has
Every story in the corpus IDML files has the same StoryPreference and
InCopyExportOption, and the same TrackChanges, StoryTitle,
AppliedNamedGrid, UserText and IsEndnoteStory (the last two from DOM 12
and 15). No INDD field for them is identified, so they are written from
IDML observation.
2026-10-07 01:21:28 +00:00
aiongg c938df6f0b feat: convert page margins, columns and layout grid
Pages store margins (chunk 0x51A) and columns (0x528) with a flag that
says whether they are the page's own; otherwise the master page at the
same position supplies them. Write MarginPreference from the values in
effect and GridDataInformation from chunk 0xCD02.
2026-10-07 01:13:34 +00:00
aiongg 0dc40563ab feat: write preference values that every exported IDML has 2026-10-07 00:35:38 +00:00
aiongg 4014eea106 feat: write font families and fonts in Fonts.xml
Read the font records of class 0x3E03 (chunk 0x3E05) and the Typekit IDs
(chunk 0x3EEB), and write FontFamily and Font elements. Evidence and the
fields left out are in docs/format/fonts.md.
2026-10-06 22:55:45 +00:00
aiongg 3490507fbf feat: convert stroke type and stroke alignment
Decode page item attribute 0x6E6E (a reference followed by a built-in
stroke style code) as StrokeType and 0x6E8C as StrokeAlignment, with
evidence from items and from object style attribute lists. Write the 18
built-in stroke styles every exported IDML lists.
2026-10-06 22:28:29 +00:00
aiongg 36b7ae9eaf feat: write root style values that every exported IDML has
Collect the root style attributes, Properties and child elements that are
the same in every corpus IDML (tools/root_values.py) and write them on the
root paragraph, character, object, cell and table styles. Values read from
the INDD take precedence; values that first appear after DOM 7 are gated
by InDesign version. Also write the default numbering list, and write a
style only once when two style objects share a name.
2026-10-06 22:04:05 +00:00