mirror of
https://github.com/storytold/indd-utils.git
synced 2026-11-22 18:20:45 +01:00
feat: write GraphicType for empty graphic frames
This commit is contained in:
1 parent
fd4f25c52e
commit
4359207564
3 files changed
+16
-1
No files matched your search
@@ -492,6 +492,13 @@ Frames, shapes and lines are all class 0x6201; groups are 0x401.
|
||||
| 0x6E03 | Attribute list: local formatting (see `attributes.md`) |
|
||||
| 0x1B916 | u32: applied object style |
|
||||
|
||||
**Content type.** A rectangle, oval or polygon with a placed graphic is
|
||||
`ContentType="GraphicType"`. Without one, chunk 0x1623 (u16) decides: 1
|
||||
is `GraphicType` (an empty graphic frame), 0 or no chunk `Unassigned`.
|
||||
In 200 of the trustworthy pairs, the 757 empty shapes with
|
||||
`GraphicType` all have 1, and the 15,768 with `Unassigned` have 0
|
||||
(13,226) or no chunk.
|
||||
|
||||
Groups store their matrix in chunk 0x40D when they have no chunk 0x151:
|
||||
with it, the `ItemTransform` of all 5,670 groups of the trustworthy
|
||||
pairs (8,788 of 8,789 over all pairs) matches; without it, 5,277 of them were
|
||||
|
||||
+1
-1
@@ -3732,7 +3732,7 @@ impl Writer<'_> {
|
||||
.attr("NextTextFrame", uref(*next))
|
||||
.attr("ContentType", "TextType");
|
||||
} else if let ItemKind::Shape(_) = item.kind {
|
||||
let content = if item.graphics.is_empty() {
|
||||
let content = if item.graphics.is_empty() && !item.props.graphic_frame {
|
||||
"Unassigned"
|
||||
} else {
|
||||
"GraphicType"
|
||||
|
||||
@@ -121,6 +121,8 @@ pub mod chunk {
|
||||
pub const ITEM_TRANSFORM: u32 = 0x151;
|
||||
/// A group's transform when it has no chunk 0x151.
|
||||
pub const GROUP_TRANSFORM: u32 = 0x40D;
|
||||
/// u16 1 for a frame meant for a graphic.
|
||||
pub const ITEM_CONTENT: u32 = 0x1623;
|
||||
pub const ITEM_PATHS: u32 = 0x162B;
|
||||
pub const ITEM_HIERARCHY: u32 = 0x15B;
|
||||
pub const COLUMN_FRAME_LIST: u32 = 0x220;
|
||||
@@ -426,6 +428,9 @@ pub struct ItemProps {
|
||||
/// The overridden master page item (0 for none) and the IDs of the
|
||||
/// attributes overridden (chunk 0x1424).
|
||||
pub overridden: Option<(u32, Vec<u32>)>,
|
||||
/// Chunk 0x1623 is 1: a frame for a graphic (`ContentType`
|
||||
/// `GraphicType` without a graphic).
|
||||
pub graphic_frame: bool,
|
||||
}
|
||||
|
||||
/// A page item name: a built-in key or a name given by the user.
|
||||
@@ -2127,6 +2132,9 @@ impl<'a> Reader<'a> {
|
||||
counts(chunk::ITEM_UPDATED_CHANGES)?,
|
||||
],
|
||||
overridden,
|
||||
graphic_frame: self
|
||||
.chunk(uid, chunk::ITEM_CONTENT)?
|
||||
.is_some_and(|d| d.len() >= 2 && Cursor::new(&d).u16().ok() == Some(1)),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user