Add the transparency attribute IDs of the outer glow (applied, blend
mode, opacity, colour, spread, size), the inner glow (applied, blend
mode, size), isolate blending and the fill opacity, and every blend
mode code as its position in the schema's enumeration (codes 2, 4, 5,
7, 14 and 15 are seen besides 0, 1, 3 and 9).
compare.py --exclude own/:
- trustworthy 98.06% -> 98.07% (+1,055 values: OuterGlowSetting of
text frames 108 of 108, of rectangles 56 of 56; BlendMode of
rectangles 271 -> 337 of 337)
- all pairs 96.21% (+1,247)
- extra values unchanged (8,968; all pairs 277,399)
IDML writes the index in the Self of ABullet in hexadecimal
(dABullet9, dABulleta); the converter wrote it in decimal from the
tenth bullet on.
compare.py --exclude own/: trustworthy 98.06% (+25 values, ABullet
3,365 of 3,365); extra values 8,993 -> 8,968.
Chunk 0x6E06 of the page item defaults object names an object of class
0x5533, a gradient and a colour. IDML writes that gradient in every
document even when nothing refers to it. The converter now treats the
swatches of the chunk as named by the page item defaults, as it does
for the entries of the two tables around the attribute list.
compare.py --exclude own/:
- trustworthy 98.05% -> 98.06% (+413 values: Gradient 756 -> 783 of
783 elements, with their stops)
- all pairs 96.20% (+815)
- extra values unchanged (8,993; all pairs 277,424)
IDML leaves out a guide owned by the spread when it lies outside the
bounding box of the spread's pages (84 of 85 such guides in the
trustworthy pairs measured before; all spread guides inside and all
page guides are written). The one exception, on a master spread, is
lost.
compare.py --exclude own/:
- trustworthy 98.05% (-12 values: the exception guide)
- extra values 10,001 -> 8,993 (no extra Guide left in trustworthy
pairs); all pairs 279,404 -> 277,424 (-48 values)
Chunk 0x6204 starts with a u16 flag before the shape code. With flag 1
the code decides (any code other than 1 to 5 is Polygon, 9 included);
with flag 0 or no chunk the path decides, whatever the code. The path
tests now require a line to have no direction points, and an oval's
second and fourth anchors to lie on the midpoint of the first and
third (within 1e-8).
compare.py --exclude own/:
- trustworthy 97.92% -> 98.05% (+16,668 values; Polygon elements
38,704 -> 38,959); documents at >= 99 %: 169 -> 175
- extra values 26,256 -> 10,001: no Oval, GraphicLine or Rectangle
element is written where the reference has another
- all pairs 96.03% -> 96.20%; extra values 306,138 -> 279,404
Read class 0x6607 (a page of another InDesign document placed in a
frame) as a placed graphic and write it as ImportedPage: PageNumber
(chunk 0x2505 u32 + 1), the attributes of placed graphics,
GraphicBounds, the text wrap and the link. ImportedPageCrop, the XMP
packet and the PDF-style children are not decoded and left out.
compare.py --exclude own/:
- trustworthy 97.91% -> 97.92% (+1,475 values; ImportedPage 38 of
38 with transform, bounds and page number, and their links)
- all pairs 96.02% -> 96.03%; 9 more links resolved to another file
at export (45 values leave the counts)
- extra values unchanged
- compare.py --all with schemas: 0 conversion and 0 schema failures
on pairs; outputs without a reference: the same 11 endnote-markup
files
Chunk 0xB30A of a shape or frame names its text path object (class
0xB320) and holds the flip, the start and end brackets and three codes.
The text path's multi-column frame holds a column of class 0xB318 that
gives the story and the thread, as for text frames. The converter
writes TextPath right after the item's Properties.
compare.py --exclude own/:
- trustworthy 97.90% -> 97.91% (+396 values; TextPath 36 of 36)
- all pairs 96.02% (+462; 42 of 42 with an INDD object)
- extra values unchanged in trustworthy pairs; all pairs +153: text
paths in 2 stale pairs whose IDML does not have them
Read class 0x660B (text kept from a placed EPS or PDF graphic) as a
page item and write it as EPSText: ItemTransform, PathBoundingBox
(chunk 0x154), EPSTextData (chunk 0x6611 in big-endian order without
two tail fields, base64), EPSTextAttributeBounds (chunk 0x6612) and
the text wrap. element_values.py collects the EPSText values every
element has.
compare.py --exclude own/:
- trustworthy 97.72% -> 97.90% (+22,108 values; EPSText 633 of 633
elements, with transform, bounds, text data and text wrap all equal)
- all pairs 95.89% -> 96.02%
- extra values unchanged in trustworthy pairs (26,256); all pairs
304,533 -> 305,985: 1 stale pair whose IDML lacks its EPS text
- not yet reproduced: EPSText StrokeType (634), OverprintFill (33),
StrokeDashAndGap (7)
num() rounded ties to even only at 17 significant digits. IDML takes
the decimal nearest to the exact value at the shortest length, with
ties to even, at any length, and writes numbers below 1e-4 with an
exponent (1e-05). The rule gives the IDML text for all but 67 of the
1,090,937 distinct numeric texts of the reference IDMLs (those 67 are
text values).
diff_outputs.py: 2,672 outputs differ, no change in failures or
warnings.
compare.py --exclude own/:
- trustworthy 97.72% (+77 values): PDF GraphicBounds 849 -> 913 of
913, EPS 323 -> 329, SVG 140 -> 146
- all pairs +99 values: PDF, EPS and SVG GraphicBounds all equal
- extra values unchanged
Record kind 2 of chunk 0x3E05 is u8 2, u8 0, the u32 UID of another
font family and a u16 count of font entries. The converter read it as
a family record and left the fonts out with a warning ("string tag 5
at 3, expected 2" and similar), in 14 Japanese pairs and 5 other files.
IDML writes a family with a count of 0 as a copy of the family it
refers to, with FontType="Unknown", Version="" and TypekitID="$ID/"
(15 of 15 pairs). The converter now does the same. For a record with
entries (4 families in 2 files, no IDML) it keeps the name and leaves
the fonts out with a warning.
compare.py --exclude own/:
- trustworthy 97.72% (+234 values: 16 fonts, FontFamily Name 15,
AppliedFont of styles and text 11); all pairs 95.89% (+234)
- extra values unchanged (26,256; all pairs 304,533)
In InDesign 3.0 files chunk 0xCB02 starts with four zero bytes before
the flagged name (9 of 9 distinct 3.0 files, both byte orders). The
converter left the composite font out with a warning ("string tag 0
at 1, expected 2"); it now reads the name after the four bytes when it
does not parse at 0. The 3.0 files convert without that warning.
No pair is from 3.0: compare.py --exclude own/ is unchanged
(trustworthy 97.72%, all pairs 95.89%).
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
Story chunk 0x2EE also holds the text orientation (u16 at 0: 0
Horizontal, 1 Vertical) and the frame type (u16 at 14: 0
TextFrameType, 1 FrameGridType). Over the 28,669 stories of all corpus
pairs both match the IDML in every story; stories without the chunk
are all TextFrameType and Horizontal. The converter writes
StoryPreference FrameType and StoryOrientation from it; the
orientation of the story's frames is used only for an unknown code.
compare.py --exclude own/:
- trustworthy coverage 97.55% -> 97.71% (11,986,627 -> 12,006,265);
StoryPreference FrameType 0 -> 19,424 of 19,424, StoryOrientation
19,210 -> 19,424 of 19,424
- all pairs 95.72% -> 95.88%
- extra values 26,256 (unchanged); all pairs 303,866 -> 304,533: the
two attributes on the stories of stale pairs that the reference does
not have
Regenerate src/idml/element_values.xml from the 827 distinct IDML files
of the corpus (683 before). Values that now vary across the IDML files
drop out:
- Story AppliedNamedGrid, StoryPreference FrameType and
StoryOrientation (stories with named grids, frame grids or vertical
text)
- Page GridStartingPoint (28 pages of DOM 18)
- TOCStyle SetStoryDirection (3 styles are Vertical)
- 9 TextDefault, 2 CjkGridPreference and 1 IndexOptions preference values
element_values.py now collects ClippingPathSettings only for
ClippingType="None", the only case in which the converter writes the
element, and leaves user-named trap presets out of the TrapPreset list.
Without these two rules a DOM 12 file with its own trap preset and 8
images with a clipping path would have removed the values for every
document.
root_values.py read the text attribute table from src/idml/mod.rs,
which moved to attrs.rs; it now runs again. Its files stay pinned and
are not regenerated (idml-values.md says why).
compare.py --exclude own/ (803 pairs, 606 trustworthy):
- trustworthy coverage 97.95% -> 97.55% (12,036,295 -> 11,986,627 of
12,287,602); all pairs 96.12% -> 95.72%
- the loss is the dropped Story AppliedNamedGrid (19,416), FrameType
(19,368), Page GridStartingPoint (10,052), TOCStyle
SetStoryDirection (618) and StoryOrientation (214)
- extra values 26,257 -> 26,256 (all pairs 305,366 -> 303,866)
- conversion failures 0 of 803
readme_numbers.py with schema validation: trustworthy value coverage
96.85% -> 98.03%, all pairs 94.89% -> 96.13%; failures and story text
unchanged. The tables now list the index, the preferences read from the
INDD, the further text attributes and font names; index topics and
print settings leave the "not started" list.
The last u16 of page chunk 0x528 is the column direction (1 vertical,
0 horizontal), inherited from the master page with the columns. It
replaces the constant Horizontal the writer wrote on every page.
compare.py --exclude own/:
- trustworthy value coverage 98.03% -> 98.03% (+14 values); all pairs
+14
- Page/MarginPreference ColumnDirection 9,274 of 9,274 (14 vertical)
- extra values unchanged; no key lost values
The writer wrote these as literals. element_values.py now collects
Story, XmlStory, Story/StoryPreference, the InCopyExportOption of
stories, rectangles, ovals and polygons, the ClippingPathSettings of
images, PDF and EPS graphics, and Ink; the writer reads them from
element_values.xml after the values it reads from the INDD.
- UserText (a WhenWritten value) is written from version 11.2, where
IDML starts to have it (was 12).
- Ink ConvertToProcess is read from byte 56 after the ink name; it was
the only ink value that varies (3 inks true).
- InCopyExportOption of ovals and the EPS clipping values follow the
versions the corpus shows (ovals from DOM 8, EPS up to DOM 20).
compare.py --exclude own/:
- trustworthy value coverage 98.03% -> 98.03% (+771 values: UserText
768, ConvertToProcess 3); all pairs 96.12% -> 96.13% (+1,211)
- extra values: trustworthy unchanged; all pairs +43 (UserText in
stale pairs whose IDML is older)
- compare.py --all with schemas: 0 schema failures on pairs; files
without a reference as before
New codes for Position, Justification, Composer, KerningMethod,
ParagraphBreakType, StartParagraph, OTFFigureStyle, SpanColumnType and
BulletsAndNumberingListType, each found by aligning INDD runs with IDML
ranges and styles by name; no run or style contradicts them.
compare.py --exclude own/:
- trustworthy value coverage 98.01% -> 98.03% (+1,859 values); all
pairs 96.10% -> 96.12% (+2,700)
- extra values: trustworthy unchanged; all pairs +13 (stale pairs)
- no key lost values
Hyphenation, glyph and word spacing, keeps, rules above, underline and
strikethrough types, colours and tints, numbering format, alignment and
level, paragraph and character direction, OpenType features, CJK
settings (aki, kinsoku, ruby, kenten) and paragraph border and shading
widths, offsets and weights. Each ID is present on a style exactly when
the IDML style has the attribute. Rule, underline and strikethrough
stroke types are a reference and a built-in code (new layout
RefOrCode); NumberingFormat is written as a string.
MergeConsecutiveParaBorders is written from version 13.1, as in IDML.
compare.py --exclude own/:
- trustworthy value coverage 97.66% -> 98.01% (+41,082 values); all
pairs 95.64% -> 96.10% (+74,262)
- of 121,196 values of these attributes, 120,409 reproduced and 3 wrong
(all 3 were wrong before)
- extra values: trustworthy unchanged; all pairs +218 (ranges and
styles of stale pairs that their IDML lacks)
- compare.py --all with schemas: 0 schema failures on pairs; files
without a reference as before
Preferences chunk 0x1A49B lists the default numbering list and the
others; each list (class 0x1A483) has its name and two flags in chunk
0x1A49A. The converter writes every list in designmap.xml, the default
first, in place of the constant default list, which it keeps only for a
file whose lists it cannot read. Paragraph attribute 0x1A417
(AppliedNumberingList) names a list by UID.
compare.py --exclude own/:
- trustworthy value coverage 97.65% -> 97.66% (+896 values); all pairs
95.63% -> 95.64% (+1,231)
- NumberingList 705 of 705 (216 more), AppliedNumberingList +32
- extra values unchanged; no key lost values
- diff_outputs.py: other outputs differ only in the position of the
AppliedNumberingList property
Story chunks 0xA44C (StoryTitle), 0x50F96 (StoryDirection, 1 right to
left) and 0x2EE (OpticalMarginSize and OpticalMarginAlignment) replace
the constant values the writer wrote for every story. Without a chunk
the story keeps the value of every story without it.
compare.py --exclude own/:
- trustworthy value coverage 97.64% -> 97.65% (+1,566 values); all
pairs 95.61% -> 95.63% (+3,461)
- StoryDirection 780, OpticalMarginAlignment 441, OpticalMarginSize 315
and StoryTitle 30 more stories right
- extra values unchanged; no key lost values
- Paragraph and character styles: SplitDocument, EmitCss and
IncludeClass from the u16 values after the tag map count of chunk
0x28F0 (when the style has no tag maps); false, true, true without
the chunk.
- Page items of master spreads: AllowOverrides from chunk 0x142D
(1 false, else true). Placed graphics and items of document spreads
have none.
- Document/Properties/Label from document chunk 0x1630B.
compare.py --exclude own/:
- trustworthy value coverage 97.48% -> 97.64% (+18,499 values); all
pairs 95.46% -> 95.61% (+22,885)
- AllowOverrides 11,791 of 11,791; paragraph style SplitDocument +3,403
and IncludeClass +2,869; document label 436 of 438
- extra values +3 (ParagraphStyle SplitDocument); no key lost values
- compare.py --all with schemas: 0 schema failures on pairs; files
without a reference as before
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
- FontType codes 0 Type1, 3 ATC and 0xFFFFFFFF Unknown.
- TypekitID from INDD version 9.2 (was 12).
- The key flag of the native style name gives FontStyleNameNative a
$ID/ prefix; the key flag of the family name gives $ID/ to the family
name in FontFamily, Font Name and every AppliedFont.
- Missing-font records (kind 3) parse: no fonts, or short font records
with style, platform name and Unknown type.
- The family name in the font's own script replaces the name when the
family's writing script is the script byte of the document users.
compare.py --exclude own/:
- trustworthy value coverage 97.36% -> 97.42% (+7,627 values); all
pairs 95.35% -> 95.41% (+9,808)
- TypekitID +3,483, FontStyleNameNative +1,262, FontType +664, 196
more Font elements matched, AppliedFont and BulletsFont +235
- extra values 26,348 -> 24,144 (Font elements whose Self now matches)
- warnings 413 -> 406 (missing-font records now parse)
- compare.py --all with schemas: 0 schema failures on pairs; files
without a reference as before
Chunk 0x1307E is now read field by field: each group's name, include
byte and header variant, then its header variants and their sections.
This replaces the search for group names. objects.md gives the layout.
diff_outputs.py: 0 differing outputs, 0 changed failures and warnings
over 4,274 files.
The index object (class 0x13004) lists its sections (class 0x13005);
chunk 0x13007 of a section holds its topic records depth first, with
their level, name, sort order and page references. The converter
writes the Index element in designmap.xml with its nested Topic
elements, and gives each PageReference its ReferencedTopic and
PageReferenceType. Evidence: docs/format/index.md.
compare.py --exclude own/:
- trustworthy value coverage 97.17% -> 97.36% (+21,617 values); all
pairs 95.21% -> 95.35% (+21,808)
- Topic 2,185 of 2,185 with Name and SortOrder; Index 16 of 16;
PageReference ReferencedTopic and PageReferenceType 7,523 of 7,523
- extra values +15: the 3 topics and 3 page references one INDD has
and its earlier IDML lacks
- compare.py --all with schemas: 0 schema failures on pairs; files
without a reference as before. One of them (DOM 19) has topic
records of another length; its sections are left out with a warning
(21 warnings).
- 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)
XMLImportPreference AllowTransform, ImportCALSTables,
ImportTextIntoTables, ImportToSelected, RemoveUnmatchedExisting,
RepeatTextElements and DictionaryPreference MergeUserDictionary are the
same in all 654 pairs. Two of the 683 IDML files differ; both were
exported by an earlier version than their INDD was last saved with, so
they are not pairs. element_values.py now leaves those files out for
these keys (LATER_INDD_EXCEPTIONS); idml-values.md records why.
compare.py --exclude own/: trustworthy value coverage 97.12% -> 97.15%
(+3,423 values, 7 keys x 489 pairs); all pairs 95.16% -> 95.19%
(+4,578). No key lost values; extra values unchanged.
InDesign writes some empty Properties children open and closed on two
lines, so their text is a line feed and tabs
(XMLImportPreference/Properties/TransformParameters). compare.py now
treats such text as empty. measurement.md says so.
Effect (measurement only, same output): P.TransformParameters
reproduced in 489 of 489 trustworthy pairs. Trustworthy value coverage
97.12% -> 97.12% (+489 values); all pairs +654.
Spreads without chunk 0x10833 get LineArtAndTextResolution 300 and
GradientAndMeshResolution 150. No INDD field decides these values:
5,045 of the 5,074 trustworthy spreads without the chunk have them; the
other 29 (all spreads of 9 documents) have 400 and 400. The evidence is
in objects.md and idml-values.md.
compare.py --exclude own/:
- trustworthy value coverage 97.03% -> 97.12% (+10,090 values); all
pairs 95.07% -> 95.16% (+13,836)
- Spread/FlattenerPreference resolutions: 5,074 missing -> 29 wrong
- extra values: trustworthy unchanged; all pairs +306 (the attributes
on spreads of stale pairs that their IDML no longer has)
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
Each run kept every converted package for both revisions, about 18 GB
over the corpus. Now the outputs of a file are deleted once they compare
equal, each run starts with empty output folders, and a commit's build
directory is deleted after its binary is copied.
compare.py now also writes target/compare/summary.json: the options of
the run (--all, schema validation, --exclude, --limit, --file), the
files, conversion failures (error messages) and schema validation
failures of the paired and the other files, and the values, reproduced
values and story counts of the trustworthy and of all pairs.
tools/readme_numbers.py rewrites the "Current numbers" table of the
README, now between `<!-- numbers:start -->` and `<!-- numbers:end -->`,
from that summary. It refuses a summary from a run that included own/,
covered part of the corpus, or ran without --all or schema validation.
With --schemas and --jing it first builds the converter and runs
`compare.py --all --exclude own/` with validation, so one command
refreshes the README; --check only reports whether it is current.
The numbers in the README are unchanged.
tools/check_wasm.sh builds the library for wasm32-unknown-unknown,
then builds a probe module (a cdylib generated under the target
directory that exports a function calling `indd::convert`) and checks
with Node.js that the module imports nothing: a conversion needs no
file system, clock or other host function. It then converts the
fetched fixtures, or the files given, in the probe module and compares
each package byte for byte with the native `indd convert` output.
No library change was needed: only `convert_file` and `read_header`
use `std::fs`, and `convert` does not call them. The 5 fixtures and 80
corpus files give the same packages in WebAssembly as natively. The
check takes about 10 s; it is documented in CLAUDE.md, CONTRIBUTING.md,
README.md and ARCHITECTURE.md. There is no hosted CI.
Idea from storytold/designcraft#98.
`src/hostile.rs` converts damaged inputs and fails if a conversion
panics or takes longer than 20 s:
- Synthetic documents built from a seed with `database::synthetic`: a
document object with well-formed lists, spreads that hold spread
layers, pages and page items, and objects of the model's classes with
chunks of the model's IDs (taken from the hexadecimal constants of the
model sources). Chunk data is shaped like UID lists, child lists,
attribute lists, strings and numbers, or random. Each document is
converted as built, with one object truncated, with bytes flipped, and
with the file image truncated, through the model and the IDML writer.
- The fixture files, if fetched: truncated at structure boundaries and
random lengths, and with 1 to 64 bytes flipped, a quarter of the cases
in the header and master pages.
The cases come from a fixed seed and run on all cores, with a watchdog
for hangs. The default sweep has about 1,600 cases and takes 2 s in a
debug build and 0.5 s in a release build (16 cores).
INDD_HOSTILE_SCALE multiplies the cases and INDD_HOSTILE_SEED changes
the seed; sweeps at scale 40 with seeds 0x1DD and 7 (about 63,000 cases
each, debug build with overflow checks) found no panic or hang.
Idea from storytold/designcraft#98.
The library and the binary now deny clippy's unwrap_used, expect_used,
panic, unimplemented, todo and unreachable lints outside unit tests, and
forbid unsafe code. Malformed input must give an error or a warning,
never a panic.
The 36 offending calls are replaced without changing behaviour:
- Byte reads that converted a slice of checked length to an array now
use the `Encoding::*_at` decoders, `first_chunk`, or a `Cursor`
helper that returns `Result`; the fallbacks are the existing results
for data of the wrong length (`Value::Other`, a skipped value, a
short-data error).
- The fixed-offset readers of the header and the master pages build the
array with `array::from_fn`; they index as before.
- `Node::set` returns the node it set, so `TextFramePreference` insets
no longer look it up again with `expect`.
- The embedded value files fall back to no values if one fails to
parse, and a block with a version bound that is not a number does not
apply. A new unit test checks that every committed file parses and
that every bound is a number.
- `Xml::end` without an open element fails a debug assertion and
writes nothing in a release build.
diff_outputs.py over the corpus (without own/): 0 differing outputs,
0 changed failures, 0 changed warnings.
Idea from storytold/designcraft#98.
- Notes (class 0xA429): their text and a Note element in place of the
U+FEFF, with dates by the link time rule, user name and document user.
- Index markers (class 0x13006): a PageReference with Self and Id in
place of the U+FEFF (topics are not written yet).
- Tracked changes: deleted text (class 0xA40A) as Change DeletedText
before the following character; inserted runs (strand run kind
0xA466) wrapped in Change InsertedText inside each character range,
closed at tables, anchored items and XML markers.
- XML markers are left out of the text when the node store cannot be
read.
- Character-level sources open before an element character (note,
destination), apart from paragraph destinations, which the schema
does not allow in them.
Trustworthy pairs: reproduced 10,772,444 -> 11,266,452 (92.60 % ->
96.85 %); stories with identical text 18,574 -> 18,602 of 18,610;
PageReference 7,523 with Id; 1,709 more hyperlink sources and
hyperlinks (in deleted text). Notes 211 of 211 and changes 6,024 of
6,027 match the reference attributes (multisets per pair, no Self).
Extra values 26,107 -> 26,333: 220 from Change elements written inside
sources where InDesign writes an empty Change before them, 9 from
PageReference. HyperlinkTextSource/Note loses 3 elements for the same
reason (the source's first child is now the Change). Schema
validation: 0 failures.
Ranges inside Footnote, Cell and Note elements were not counted: the
element counted as one position of the story text and its own ranges
were skipped. Each now forms a text flow of its own, with offsets from
0, compared when the story's text is identical (it already includes
their text). The headline counts everything InDesign writes.
Trustworthy pairs: reference values 11,508,691 -> 11,632,968,
reproduced 10,669,264 -> 10,772,444, coverage 92.71 % -> 92.60 %; extra
values unchanged (26,107); no key reproduces fewer values.
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.
- 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.
The walker of the previous commit counted every element outside a
character range, such as StoryPreference, as a text position. A story
whose reference has MetadataPacketPreference, which the converter does
not write, then had all its range offsets shifted by one. Only Content
and elements inside a character range count now.
Trustworthy pairs at HEAD: reproduced 10,578,767 -> 10,579,111 (91.92 %),
extra values 26,516 -> 26,179; reference values unchanged. The numbers
in docs/measurement.md for the measurement change are re-measured with
the corrected rule (10,505,425 reproduced, 26,297 extra values). No key
reproduces fewer values.
InDesign 5.0 destinations have no key, hyperlinks name their destination
by UID, text destination owners use chunk 0x1351E, and text sources are
placed by start and end markers owned by the story (chunk 0x13524)
instead of a range tree. These are read by version; keys are left out
where there are none.
No 5.0 file has an IDML. Over the 17 5.0 files with hyperlinks: 121
hyperlinks, 118 text sources, 7 text destinations and 45 bookmarks are
now written, the 116 warnings about their destination objects are gone,
and every output validates. Pair results unchanged (91.92 %, extra
values 26,516). Schema validation: 0 failures.
Class 0x13552 objects are written as HyperlinkExternalPageDestination:
hidden and key from chunk 0x13580, page index from chunk 0x1B8, view
from chunk 0x13527, and the name IDML derives from the linked
document's file name. DocumentPath is left out (it starts with a volume
name the INDD does not hold). Hyperlinks of kind 2004 and bookmarks now
find them.
Trustworthy pairs: reproduced 10,566,138 -> 10,578,767 (91.81 % ->
91.92 %); 643 of 643 external page destinations with all values but
DocumentPath, 576 more hyperlinks, bookmarks 452 -> 1,027 of 1,027.
Extra values unchanged (26,516); no key reproduces fewer values. Schema
validation: 0 failures.