Commit Graph
53 Commits
Author SHA1 Message Date
aiongg 6f8a8fe932 feat: write the stroke weight of items that have none of their own 2026-10-07 16:24:18 +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 3196061da1 feat: write every object style category from its category IDs
With the larger corpus each Enable attribute of object styles, and the
transparency flag of the four effects categories, follows one ID or a
group of IDs that always occur together in the category list.

Value coverage on trustworthy pairs: 87.13 % to 87.31 %.
2026-10-07 14:34:23 +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 44f2d9c1a7 feat: write the index sort options of every document
The index groups of the preferences object become IndexingSortOption
elements in their stored order, with their include flag and a header
type by group and header variant.

Value coverage on trustworthy pairs: 86.86 % to 87.08 %.
2026-10-07 14:01:56 +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 5344dc2148 fix: tell polygons from ovals and rectangles by the stored shape code
Chunk 0x6204 of a frame holds a shape code that gives the IDML element
(line, rectangle, oval or polygon). Without a code, a closed four-point
path is an oval only when all its points are of type 0. About 5,000
shapes of the trustworthy pairs that were written as ovals are polygons,
with all their attributes and children.

Value coverage on trustworthy pairs: 84.50 % to 86.72 %.
2026-10-07 13:11:59 +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 f5c73f9460 fix: convert or clearly reject every file in the fetched sample batch
- InDesign 5.0: read document chunk 0x13501 with the 3.0/4.0 layout
  (four UID lists); the 6.0 layout failed on 17 files.
- Reject files that are shorter than their database pages as truncated,
  and check the signature before the size so that short files of other
  kinds are reported as not INDD files. The corpus tests accept both.
- Hyperlink page destinations: write view setting 0 as Fixed (567 of 567
  in the pairs); leave out a zoom outside the schema's 5-4000 %.
- Leave out, with a warning, values the IDML schema does not allow: ink
  neutral density -1, writing script 0xFFFFFFFF, negative drop shadow
  size and other out-of-range transparency values. The IDML writer now
  returns its own warnings.
2026-10-07 07:59:23 +00:00
aiongg 3e89cad3bd fix: convert or clearly reject every file in the new sample batch
- Bullet list: the font style can be followed by 1 and four bytes.
- InDesign 2.0: in-object strings start with 1, not 2.
- InDesign 2.0-5.0: XML tag names are a flag byte and a string, in
  either byte order.
- InDesign 3.0 and 4.0: the document's hyperlink lists start at offset
  0 and include page destinations.
- XMP: the packet can be shorter than its object; take its length.
- InDesign 1.x files (no signature, DOCUMENT at 0x5C) are reported as
  not supported; files whose page directory lies beyond the database
  pages as having no object database.
- Schema: leave out hyperlink sources that hold an anchored object, and
  the characters U+FFFE and U+FFFF, which XML does not allow.

tests/corpus.rs accepts the two rejections above and skips the paths
listed in the local corpus/exclude.txt.
2026-10-07 06:27:26 +00:00
aiongg bf72b93d23 test: download fixtures from pinned sources instead of committing them
Remove the sample documents, PDF and licence copies from tests/fixtures/.
tests/fixtures/manifest.json lists each file's download URL (pinned to a
commit for GitHub sources), size and SHA-256. tools/fetch_fixtures.py
downloads them into the git-ignored tests/fixtures/files/ and verifies
them. The fixture tests read from there and skip when it is absent.
2026-10-07 05:47:17 +00:00
aiongg 790d22d483 feat: write first baseline offset code 3 as EmboxHeight 2026-10-07 05:17:22 +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 6a357f4287 feat: write the Kanji page number style
Section style code 0x4C12 is Kanji, shown by the Chinese-numeral folios
of a vertically typeset sample's print PDF. Pages in such a section are
named with Chinese digits, as the folios show.
2026-10-07 04:26:16 +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 7c89bdfe8a fix: write only colour models the samples show
Code 1 is Spot in two pairs; code 3 has no sample, so its Model is now
left out with a warning instead of written as MixedInkModel.
2026-10-07 04:15:57 +00:00
aiongg a9985b3775 fix: validate every corpus output and fix the two schema failures
compare.py --all now also converts the INDD and INDT files that have no
same-version IDML (any version, either byte order), validates them and
counts converter warnings by kind. validate.sh runs Jing once per schema
instead of once per file, which makes validating the whole corpus take
about 3 minutes.

Two schema failures showed up in files without an IDML:

- Gradient swatch midpoints are stored as positions from the start of
  the gradient. IDML wants them relative to the gap between two stops,
  as for opacity gradient stops. Values outside 13-87 are left out with
  a warning.
- The style kind is a u16, not a u32. One InDesign 7.5 template has a
  non-zero u16 after it, which made 151 character styles paragraph
  styles.
2026-10-07 03:50:08 +00:00
aiongg 1d0e27db32 feat: convert big-endian files from InDesign 3.0 and 4.0
The byte order flag applies to object data only: database pages stay
little-endian. Object data is decoded in the file's byte order, and in
big-endian data the string tag and the flag byte before it are swapped.

The two big-endian samples are also the only files from before
InDesign 7.0, and some of their layouts differ: page transform and
bounds chunks, font records, XML tag names and nodes, story strands and
40-byte guide records are read; text frame settings, document
preferences, a composite font and a section style are left out with a
warning. The 40-byte guides of an InDesign 7.0 file are now read too.

docs/format/big-endian.md records the evidence. The corpus tests now
cover all byte orders.
2026-10-07 03:11:04 +00:00
aiongg 496c3e5d65 feat: convert the XML structure
Read the XML nodes stored with each story, place their markers in the
story text and write the backing story as XmlStory, with the elements
in it and in the stories they tag. Element Self names follow the node
IDs from the root down. The backing story is added to StoryList.
2026-10-07 02:42:17 +00:00
aiongg 56b59e1319 fix: count story positions in characters, not UTF-16 units
Text records count UTF-16 code units, but style runs, owned items and
text owners count a surrogate pair as one position. Convert those
positions to UTF-16 offsets so characters outside the Basic Multilingual
Plane keep their formatting and are not split into two replacement
characters.
2026-10-07 02:27:40 +00:00
aiongg 201697c779 feat: convert XML tags
XML tags (class 0xBF19) hold their name in chunk 0xBF2F and refer to an
interface colour in chunk 0x117. Write them in XML/Tags.xml, sorted by
name as IDML lists them.
2026-10-07 01:44:20 +00:00
aiongg 7bde5098a6 feat: convert anchored object offset and vertical alignment
Anchors and object styles hold anchored object settings in chunk
0x2800: the Y offset at 0 and the vertical alignment at 52. Write them
on object styles, and on anchored items where they differ from the
item's object style.
2026-10-07 01:43:24 +00:00
aiongg 537af3af4d feat: convert the bullet character list
The preferences object lists the bullet characters offered for lists in
chunk 0x1A488. Write them as ABullet elements.
2026-10-07 01:42:37 +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 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 9594ac557b feat: convert tint swatches 2026-10-07 00:04:23 +00:00
aiongg 3ca668e96e feat: convert text variables and their instances
Read text variable definitions (class 0xCAB4) into designmap TextVariable
elements with their settings, and write instances (class 0xCA64) as
TextVariableInstance elements in place of U+0018. Evidence and the
settings left out are in docs/format/text-variables.md.
2026-10-06 23:03:09 +00:00
aiongg 358fb2dbe1 feat: convert ruler guides
Read guide objects (class 0x3301, chunk 0x3308) from spread layers and
write them as Guide elements in their page: orientation, location, fit to
page, guide type, item layer, and the view threshold and colour values the
samples show. Locations are measured from the spread, and ViewPreference
states RulerOrigin SpreadOrigin to match.
2026-10-06 22:20:45 +00:00
aiongg 6475d01841 docs: describe evidence from the non-public sample in general terms 2026-10-06 20:31:49 +00:00
aiongg e1acc98fa8 feat: convert start paragraph, drop caps, letter spacing and first baseline offset
Map paragraph attributes 0x1B37 (StartParagraph), 0x1B0D and 0x1B0E
(drop cap characters and lines), 0x1B31 and 0x1B32 (maximum and minimum
letter spacing), and the text frame's first baseline offset code in
chunk 0x2CE. Evidence is recorded in docs/format.
2026-10-06 20:30:55 +00:00
aiongg 18206fca5b feat: convert small caps, jump and bounding-box wrap, and Roman page numbers
Capitalization codes 1 (SmallCaps) and 3 (CapToSmallCap), text wrap
modes 1 (JumpObjectTextWrap) and 3 (BoundingBoxTextWrap) with offsets
stored as left, top, right, bottom, and page number style 0x4C17
(LowerRoman) with Roman page names. Evidence in docs/format.
2026-10-06 19:51:56 +00:00
aiongg b0658ad13a feat: convert text wrap mode of page items and graphics
Read chunk 0x3703 (mode, offsets, flags) and the contour type in chunk 0x373D, and write TextWrapPreference for page items, groups and placed graphics. Modes 0 (None) and 6 (Contour) are written; other modes are left out with a warning. Offsets are written only when all are 0, since their order is not known yet.
2026-10-06 19:02:02 +00:00
aiongg 950dec81ce feat: convert all sections of a document
Read each section's first page and page number style from chunk 0x4C02, sort sections by their first page, and write one Section per section with its length. Write PageNumberStart only when numbering restarts, and PageNumberStyle only for the Arabic style seen in the corpus. Pages are named by their number in their section.
2026-10-06 18:55:34 +00:00
aiongg 38a9154bc5 feat: write the applied master of master pages
Master pages use the same chunk 0x140F as document pages. Write AppliedMaster and MasterPageTransform for them too: "n" and the identity matrix when the chunk is absent or empty, as in all corpus pairs, and the named master spread otherwise.
2026-10-06 18:48:01 +00:00
aiongg 5c024c0413 feat: convert embedded and pasted graphics with their contents 2026-10-06 18:22:23 +00:00
aiongg 534e37549a feat: convert gradients and corner and gradient item attributes
Read gradient swatches (stops, locations, midpoints, type) and write them
to Graphic.xml after the swatches, as the schema requires. Write
CornerOption, CornerRadius and gradient start and length on page items.
Decode unknown 4-byte attribute values as numbers.
2026-10-06 17:43:37 +00:00
aiongg 69573c8461 feat: convert document and text frame preferences
Write DocumentPreference (page size, facing pages, bleeds, intent) and
TextFramePreference (columns, gutter, column width, vertical
justification, auto-sizing). compare.py now also compares child elements
without Self and the preference elements.
2026-10-06 17:26:36 +00:00
aiongg 2da8d4eb7c feat: convert style groups, object styles, master names and sections
Write the style hierarchy with root and nested groups and path-qualified
style references, object styles with AppliedObjectStyle on page items,
master spread names and prefixes, and sections with their numbering.
Keep negative zero in numbers, as IDML does.
2026-10-06 16:45:43 +00:00