diff --git a/docs/format/attributes.md b/docs/format/attributes.md index 33326eb..f103b3a 100644 --- a/docs/format/attributes.md +++ b/docs/format/attributes.md @@ -229,7 +229,8 @@ Line end codes (u32): 0 `None`, 0x5A03 `SimpleArrowHead` (1 item), 0x5A04 `SimpleWideArrowHead` (110 items in 5 files), 0x5A05 `TriangleArrowHead` (44 in 8), 0x5A06 `TriangleWideArrowHead`, 0x5A07 `BarbedArrowHead` (64 in 6), 0x5A08 `CurvedArrowHead`, 0x5A09 -`CircleArrowHead`, 0x5A0A `CircleSolidArrowHead` and 0x5A0D +`CircleArrowHead`, 0x5A0A `CircleSolidArrowHead`, 0x5A0C +`SquareSolidArrowHead` (the page item defaults of 5 files) and 0x5A0D `BarArrowHead`. `EndCap` 2 occurs on 4 items in 3 files, `EndJoin` 2 on 6 items in 1 file. One line in the pairs before 2026-10 has 0x6E71 = 0x5A08 and 0x6E72 = 0x5A0D with `LeftLineEnd="CurvedArrowHead"` and @@ -276,9 +277,11 @@ with the same table (`preferences.md`). **Not identified.** `LeftArrowHeadScale` and `RightArrowHeadScale` are 100 in every object style and in every `PageItemDefault` but one, as are -0x6E95 and 0x6E96, so the two IDs cannot be told apart; the converter -writes them from the value files on object styles only. 0x6E78 is 0 in -every style, 0x6E73 in all but 2. 0x6E67, 0x6E6A and 0x6E8B are the +0x6E95 and 0x6E96, so the two IDs cannot be told apart. The converter +writes them from the value files on object styles, and from the IDs in +their order on `PageItemDefault`, where the values are equal in every +file (`preferences.md`, page item defaults). 0x6E78 is 0 in every style, +0x6E73 in all but 2; 0x6E78 is `Nonprinting` of `PageItemDefault`. 0x6E67, 0x6E6A and 0x6E8B are the overprint flags (`objects.md`, object style settings). `StrokeCornerAdjustment` and `StrokeDashAndGap` do not occur in the corpus IDML files. @@ -821,6 +824,36 @@ not listed leaves the attribute out. | 0x1BD5 | `ParagraphShadingWidth` | 0 `ColumnWidth`, 1 `TextWidth` | 386 (6) | | 0x1BD7 | `ParagraphShadingClipToFrame` | bool | 388 (8) | +**Found in the corpus of 2026-10.** These IDs are in every text default +list (chunk 0x23F of the preferences, 1,460 of 1,460 files, no +contradiction) and in styles and runs. Counts are the converter's +output over the 1,251 trustworthy pairs, all reproduced, with no extra +value: + +| ID | IDML | Encoding | Text defaults; styles; ranges | +|---|---|---|---| +| 0x1B3A | `KeepFirstLines` | num | 1,251; 1,258 paragraph styles | +| 0x1B3B | `KeepLastLines` | num | 1,251; 1,258 paragraph styles | +| 0x42C1 | `AllowArbitraryHyphenation` | bool | 1,251; 1,270; 30 | +| 0x4264 | `GridGyoudori` | num | 1,251; 1,323; 80 | +| 0x4268 | `RotateSingleByteCharacters` | bool | 1,251; 1,277; 329 | +| 0x4261 | `AutoTcy` | num | 1,251; 1,285; 241 | +| 0x42A3 | `ScaleAffectsLineHeight` | bool | 1,251; 1,359 paragraph and character styles; 879 | +| 0x1BD4 | `ParagraphShadingOverprint` | bool | 1,032; 1,033 | +| 0x1BFD | `ParagraphBorderType` (Properties) | stroke type | 918; 919 | +| 0x4233 | `RubyFont` (Properties) | u32 font family UID; 0 is `$ID/` (as `BulletsFont`) | 1,251; 1,255; 23 | +| 0x4257 | `KentenFillColor` (Properties) | swatch | 1,251; 1,262; 23 | + +`KeepFirstLines` and `KeepLastLines` are equal in every list (2 in all +but one file, 1 in that one), also in every paragraph style that has +them, so which ID is which is assumed from their order. 0x1BD4 is told +from 0x1BD8 by one document whose shading is overprinted (0x1BD4 1, +0x1BD8 0). 0x4233 and 0x4257 are told apart in the one document that +sets them by the class of the stored UID: a font family (class 0x3E03) +and a colour. `ParagraphBorderType` uses the stroke type codes of page +items: 0x5A29 `Solid` in 1,042 files, 0x5A3F `Japanese Dots` in one. +0x1BD4 and 0x1BFD are absent exactly where IDML has no attribute. + `MergeConsecutiveParaBorders` is in IDML from version 13.1 (in none of the 3 trustworthy pairs of version 13.0, in all 46 of 13.1); the converter writes it when the header or the last session of the save diff --git a/docs/format/idml-values.md b/docs/format/idml-values.md index 42471e8..83d6534 100644 --- a/docs/format/idml-values.md +++ b/docs/format/idml-values.md @@ -42,11 +42,11 @@ InDesign version or later (`MinimumVersion` in the file). | Root style | Values | Same in | Written for version | |---|---|---|---| -| `[No paragraph style]` | 81 | 1,448 of 1,448 files | all | +| `[No paragraph style]` | 72 | 1,448 of 1,448 files | all | | | 1 | 1,437 of 1,437 files with DOM 8 or later | 8 and later | | | 3 | 1,331 of 1,331 (DOM 10 or later) | 10 and later | -| | 4 | 1,211 of 1,211 (DOM 11 or later) | 11 and later | -| | 16 | 1,039 of 1,039 (DOM 13 or later) | 13 and later | +| | 3 | 1,211 of 1,211 (DOM 11 or later) | 11 and later | +| | 14 | 1,039 of 1,039 (DOM 13 or later) | 13 and later | | | 1 | 640 of 640 (DOM 15 or later) | 15 and later | | | 1 | 61 of 61 (DOM 21) | 21 | | `[No character style]` | 1 | 1,448 of 1,448 | all | @@ -92,7 +92,7 @@ pair rule leaves them out: an IDML (DOM 7) beside an INDD of version 17.2 that has no root styles at all, and a big-endian pair of version 11.2 whose table style lacks four region cell style values that every other file has. -**Left out because the converter reads them from the INDD:** 205 +**Left out because the converter reads them from the INDD:** 217 attributes of `[No paragraph style]`, listed in `attributes.md`. Some of these are also the same in every IDML; the INDD value is written. diff --git a/docs/format/preferences.md b/docs/format/preferences.md index 5af5cf1..23334b5 100644 --- a/docs/format/preferences.md +++ b/docs/format/preferences.md @@ -158,7 +158,13 @@ converter writes it as `TextDefault` with the same attribute table as styles. Over all pairs this reproduces 182,742 of 196,543 `TextDefault` values, against 159,982 from the observed values alone; no attribute reproduced before is lost. As for paragraph styles, `KerningValue` is -left out: the schema does not allow it there. +left out: the schema does not allow it there. The IDs of `KeepFirstLines`, +`ParagraphBorderType`, `RubyFont` and the others found in the corpus of +2026-10 are in every list where IDML has the attribute +(`attributes.md`, more paragraph and character attributes): each is +reproduced in 1,251 of 1,251 trustworthy pairs (`ParagraphBorderType` +918 of 918 and `ParagraphShadingOverprint` 1,032 of 1,032, the pairs +whose IDML has them). ## Text (`TextPreference`, `TextFramePreference`) @@ -299,8 +305,25 @@ pairs: `AutoFit` absent and `false` in 1,324, `FittingOnEmptyFrame` The page item attributes of the list also give the stroke attributes of `PageItemDefault` (`attributes.md`, strokes): `StrokeTint`, `GapColor`, `GapTint`, `EndCap`, `EndJoin`, the line ends and `ArrowHeadAlignment`, -each reproduced in every trustworthy pair whose IDML has it, except 4 -`RightLineEnd` values (a line end code not identified). +each reproduced in every trustworthy pair whose IDML has it. + +The list has five more IDs that `PageItemDefault` has (1,460 of 1,460 +files; values over all pairs): + +| ID | Attribute | Values | +|---|---|---| +| 0x551E | `GradientFillAngle` | f64; 90 in 5 files | +| 0x5524 | `GradientStrokeAngle` | f64; 90 in 4 files | +| 0x6E78 | `Nonprinting` | u16 bool; `true` in 1 file | +| 0x6E95, 0x6E96 | `LeftArrowHeadScale`, `RightArrowHeadScale` | f64; 100, and 80 in one file (both) | + +The two gradient angles are told apart by one file with fill angle 90 +and stroke angle 0. The two arrowhead scales are equal in every file, so +which ID is which is assumed from their order; the IDs are in the list +exactly where IDML has the attributes (1,159 files, from version 12.0 +on). The line end code 0x5A0C is `SquareSolidArrowHead` (5 files). The +overprint IDs 0x6E67, 0x6E6A and 0x6E8B are 0 in every list, but IDML +has the attributes in only 16 and 12 files, so they are not written. ## Print settings (`PrintPreference`, `PrintBookletPrintPreference`) diff --git a/src/idml/attrs.rs b/src/idml/attrs.rs index 0313c22..205d8bf 100644 --- a/src/idml/attrs.rs +++ b/src/idml/attrs.rs @@ -796,6 +796,22 @@ pub(super) const TEXT_ATTRS: &[(u32, &str, Kind, bool)] = &[ false, ), (0x1BD7, "ParagraphShadingClipToFrame", Kind::Bool, false), + (0x1BD4, "ParagraphShadingOverprint", Kind::Bool, false), + ( + 0x1BFD, + "ParagraphBorderType", + Kind::Builtin("StrokeStyle/$ID/", STROKE_TYPES), + true, + ), + (0x1B3A, "KeepFirstLines", Kind::Number, false), + (0x1B3B, "KeepLastLines", Kind::Number, false), + (0x42C1, "AllowArbitraryHyphenation", Kind::Bool, false), + (0x4264, "GridGyoudori", Kind::Number, false), + (0x4268, "RotateSingleByteCharacters", Kind::Bool, false), + (0x4261, "AutoTcy", Kind::Number, false), + (0x42A3, "ScaleAffectsLineHeight", Kind::Bool, false), + (0x4233, "RubyFont", Kind::FontOrNone, true), + (0x4257, "KentenFillColor", Kind::SwatchOrText, true), ]; /// Paragraph shading corner option codes. @@ -972,9 +988,20 @@ const LINE_ENDS: &[(u32, &str)] = &[ (0x5A08, "CurvedArrowHead"), (0x5A09, "CircleArrowHead"), (0x5A0A, "CircleSolidArrowHead"), + (0x5A0C, "SquareSolidArrowHead"), (0x5A0D, "BarArrowHead"), ]; +/// Attributes of `PageItemDefault` beyond the page item table +/// (`docs/format/preferences.md`, page item defaults). +pub(super) const ITEM_DEFAULT_ATTRS: &[(u32, &str, Kind)] = &[ + (0x551E, "GradientFillAngle", Kind::Number), + (0x5524, "GradientStrokeAngle", Kind::Number), + (0x6E78, "Nonprinting", Kind::Bool), + (0x6E95, "LeftArrowHeadScale", Kind::Number), + (0x6E96, "RightArrowHeadScale", Kind::Number), +]; + /// Gradient attributes every page item has: attribute-list ID (0 for /// none, `GradientStroke...` of groups), IDML name, value without the /// attribute. Fill and stroke start and length are in `ITEM_ATTRS`. See @@ -1483,6 +1510,13 @@ impl Writer<'_> { self.attr_values(attrs, ITEM_ATTRS) } + /// IDML attributes of the page item defaults list. + pub(super) fn item_default_values(&self, attrs: &Attrs) -> Vec<(&'static str, String)> { + let mut out = self.attr_values(attrs, ITEM_ATTRS); + out.extend(self.attr_values(attrs, ITEM_DEFAULT_ATTRS)); + out + } + /// IDML attributes of a table or (`style`) table style attribute /// list. pub(super) fn table_attrs(&self, attrs: &Attrs, style: bool) -> Vec<(&'static str, String)> { diff --git a/src/idml/resources.rs b/src/idml/resources.rs index 5eafd8a..c7f8615 100644 --- a/src/idml/resources.rs +++ b/src/idml/resources.rs @@ -741,7 +741,7 @@ impl Writer<'_> { } if let Some(a) = &prefs.item_defaults { let i = ours_of(&mut ours, "PageItemDefault"); - let values = self.item_attr_values(a); + let values = self.item_default_values(a); ours[i] .attrs .extend(values.into_iter().map(|(k, v)| (k.to_string(), v))); diff --git a/src/idml/root_values.xml b/src/idml/root_values.xml index 12b1e2d..ca49461 100644 --- a/src/idml/root_values.xml +++ b/src/idml/root_values.xml @@ -8,15 +8,13 @@ tools/root_values.py; evidence in docs/format/idml-values.md. --> - + Swatch/None Swatch/None - $ID/ Text Color Text Color $ID/ - Text Color Text Color @@ -65,7 +63,7 @@ tools/root_values.py; evidence in docs/format/idml-values.md. - + @@ -78,12 +76,7 @@ tools/root_values.py; evidence in docs/format/idml-values.md. - - - Swatch/None - StrokeStyle/$ID/Solid - - + diff --git a/src/idml/values.rs b/src/idml/values.rs index 21f1593..109f931 100644 --- a/src/idml/values.rs +++ b/src/idml/values.rs @@ -434,13 +434,13 @@ mod tests { fn gates_values_by_version() { let old = root_style("ParagraphStyle", 7); let new = root_style("ParagraphStyle", 21); - assert_eq!(old.attr("KeepFirstLines"), Some("2")); - assert_eq!(old.attr("KeepLastLines"), Some("2")); + assert_eq!(old.attr("PageNumberType"), Some("AutoPageNumber")); assert!(old.attr("EmitCss").is_none()); assert_eq!(new.attr("EmitCss"), Some("true")); + assert!(old.attr("ParagraphBorderOverprint").is_none()); + assert_eq!(new.attr("ParagraphBorderOverprint"), Some("false")); let props = new.child("Properties").unwrap(); assert!(props.child("RuleBelowGapColor").is_some()); - assert!(props.child("ParagraphBorderType").is_some()); let os = root_style("ObjectStyle", 21); assert!( os.child("TextFramePreference") diff --git a/src/model/attrs.rs b/src/model/attrs.rs index a0bb4a4..45ca553 100644 --- a/src/model/attrs.rs +++ b/src/model/attrs.rs @@ -323,8 +323,9 @@ fn text_layout(id: u32) -> Option { // Ruby and kenten font styles are strings too (attributes.md, // ruby, kenten and warichu). 0x1B02 | 0x1A414 | 0x1A423 | 0x1A424 | 0x4234 | 0x424B => Layout::String, - // Stroke types of rules, underline and strikethrough. - 0x1B71 | 0x1B72 | 0x1B95 | 0x1B9D => Layout::RefOrCode, + // Stroke types of rules, underline, strikethrough and paragraph + // borders. + 0x1B71 | 0x1B72 | 0x1B95 | 0x1B9D | 0x1BFD => Layout::RefOrCode, 0x422E => Layout::Text, 0x1B29 => Layout::TabList, 0x1B75 => Layout::NestedStyles,