Commit Graph
6 Commits
Author SHA1 Message Date
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 0da35fd644 feat: first INDD to IDML conversion
Build a document model (layers, spreads, master spreads, pages, page
items with path geometry, text frame threading, stories with paragraph
and character style runs, style names and hierarchy) and write it as an
IDML package with a minimal stored-ZIP writer.

Add tools/compare.py, which converts every corpus pair and compares the
result with the reference IDML. First run: all 351 little-endian files
convert; 921 of 1120 stories match exactly.
2026-10-06 16:17:00 +00:00
aiongg 326a851346 feat: read the object database
Decode the database pages: page trailers and types, the logical page
table, the object B+ tree keyed by (UID, segment), data pages, slotted
pages and continued records. Database::object returns any object's byte
stream. Add `indd objects` and `indd object` commands.

Every object of all 351 little-endian corpus files reads without an
inconsistency. Big-endian databases report Unsupported for now.

Add a project CLAUDE.md with the clean-room rules.
2026-10-06 15:57:48 +00:00
aiongg ac957b0eb2 feat: read master pages and contiguous objects
Select the active master page by sequence number, read the database page
count, iterate the contiguous objects after the database pages, and
extract the XMP packet. `indd info` now prints these fields.

The layout comes from Adobe's BSD-licensed XMP Toolkit SDK and is checked
against all 352 corpus files and the fixtures. Add Adobe's BlueSquare.indd
sample (BSD) as a fixture and record the XMP Toolkit as a permitted
reference.
2026-10-06 15:34:39 +00:00
aiongg 8d156bfeba feat: read INDD header and set up clean-room project
Decode the signature, byte-order flag and InDesign version from the INDD
header, add an `indd info` command, and add smoke tests on four
open-licensed sample files plus an optional local corpus test.

Document the clean-room method and the header layout with the evidence
for each field.
2026-10-06 15:22:17 +00:00