Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge upstream/main into print-color

aiongg65c387732d45
diff --cc Cargo.lock
index 701ff7efb,e278722b7..3f39c5918
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -820,7 -950,7 +950,7 @@@ dependencies =
[[package]]
name = "craft-atomic"
version = "0.1.0"
- source = "git+https://github.com/storytold/craft-libs?rev=e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e#e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"rustix 1.1.5",
]
@@@ -828,7 -958,7 +958,7 @@@
[[package]]
name = "craft-cms"
version = "0.1.0"
- source = "git+https://github.com/storytold/craft-libs?rev=e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e#e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"rayon",
]
@@@ -836,12 -966,12 +966,12 @@@
[[package]]
name = "craft-docpath"
version = "0.1.0"
- source = "git+https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09a67fb9a3fbd17ffe63#82a24b006eefa036b43c09a67fb9a3fbd17ffe63"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
[[package]]
name = "craft-pdf"
version = "0.1.0"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"bytemuck",
"hayro",
@@@ -854,20 -984,48 +984,48 @@@
[[package]]
name = "craft-print"
version = "0.1.0"
- source = "git+https://github.com/storytold/craft-libs?rev=d991bf6792f8ade99c51358bf3c1d902c8cd96b5#d991bf6792f8ade99c51358bf3c1d902c8cd96b5"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
+ "craft-winprint-gdi",
+ "miniz_oxide 0.8.9",
+ "roxmltree 0.20.0",
"tempfile",
+ "winprint",
+ "winsafe",
]
[[package]]
name = "craft-ui"
version = "0.1.0"
- source = "git+https://github.com/storytold/craft-libs?rev=5c874d51eeb3de70e735c8ce87a59a7dedd47675#5c874d51eeb3de70e735c8ce87a59a7dedd47675"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"egui",
+ "log",
+ "objc2 0.6.4",
+ "objc2-app-kit 0.3.2",
+ "objc2-foundation 0.3.2",
"serde",
]
+ [[package]]
+ name = "craft-window"
+ version = "0.1.0"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
+ dependencies = [
+ "egui",
+ "objc2 0.6.4",
+ "objc2-app-kit 0.3.2",
+ "wayland-client",
+ ]
+
+ [[package]]
+ name = "craft-winprint-gdi"
+ version = "0.1.0"
+ source = "git+https://github.com/storytold/winprint.rs?rev=417ac3c4d14d3da5485a99c7d5ce8f05664ec312#417ac3c4d14d3da5485a99c7d5ce8f05664ec312"
+ dependencies = [
+ "windows-sys 0.61.2",
+ ]
+
[[package]]
name = "crc32fast"
version = "1.5.2"
@@@ -1155,10 -1362,9 +1362,10 @@@ dependencies =
[[package]]
name = "designcraft-pdf"
- version = "0.12.0"
+ version = "0.13.0"
dependencies = [
"chrono",
+ "craft-cms",
"craft-pdf",
"designcraft-color",
"designcraft-compose",
@@@ -2124,7 -2471,7 +2472,7 @@@ dependencies =
[[package]]
name = "hayro"
version = "0.7.1"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"bytemuck",
"hayro-interpret",
@@@ -2144,8 -2491,7 +2492,7 @@@ checksum = "9f4d0e94ddd48749f06bbe4e538
[[package]]
name = "hayro-cmap"
version = "0.1.0"
- source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "24d285dc30731c8485de5fa732fbdf2b3affdf01e4da7c2135022ca6fa664bf6"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"brotli",
"hayro-postscript",
@@@ -2154,7 -2500,7 +2501,7 @@@
[[package]]
name = "hayro-interpret"
version = "0.7.0"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"bitflags 2.13.2",
"hayro-cmap",
@@@ -2172,7 -2518,7 +2519,7 @@@
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"fearless_simd",
"hayro-ccitt",
@@@ -2190,13 -2536,12 +2537,12 @@@ dependencies =
[[package]]
name = "hayro-postscript"
version = "0.1.0"
- source = "registry+https://github.com/rust-lang/crates.io-index"
- checksum = "885c5ef0654933139a9b9546fc2c69e18d37f38aa2520f079092b1be18f1fcaa"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
"flate2",
"hayro-ccitt",
@@@ -2560,9 -3042,9 +3043,9 @@@ dependencies =
[[package]]
name = "krilla"
version = "0.8.2"
- source = "git+https://github.com/aiongg/craft-libs?rev=8fbfea8840f0a0f5a22df18901e9db324894b2ce#8fbfea8840f0a0f5a22df18901e9db324894b2ce"
-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"
++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"
dependencies = [
- "base64",
+ "base64 0.22.1",
"bumpalo",
"flate2",
"float-cmp",
diff --cc Cargo.toml
index 82e895afa,afa0d7be9..324c022b4
--- a/Cargo.toml
+++ b/Cargo.toml
@@@ -12,9 -12,7 +12,9 @@@ repository = "https://github.com/storyt
[workspace.dependencies]
# Shared reader and writer; publish the immutable revision before this consumer.
- craft-pdf = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.1.0", default-features = false }
-craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0", default-features = false }
++craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0", default-features = false }
+# Separations, ink coverage and the ink manager; same revision as craft-pdf and the krilla patch.
- craft-prepress = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.1.0" }
++craft-prepress = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0" }
# internal
designcraft-geom = { path = "crates/geom" }
designcraft-color = { path = "crates/color" }
@@@ -77,22 -75,26 +77,26 @@@ zip = { version = "3", default-feature
indd = { git = "https://github.com/storytold/indd-utils", branch = "main" }
# Which paths stored in documents may be followed (craft-libs).
- craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "82a24b006eefa036b43c09a67fb9a3fbd17ffe63" }
-craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }
++craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }
# Atomic file replacement for saves and exports (craft-libs).
- craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e" }
-craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }
++craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }
# File › Print through the system print spooler (craft-libs).
- craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d991bf6792f8ade99c51358bf3c1d902c8cd96b5" }
-craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }
++craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }
# ICC colour management: working spaces, transforms, black point compensation (craft-libs).
- craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e" }
-craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }
++craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }
# ui
# Shared frontend components; keep this dependency above the engine boundary.
- craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }
- egui = "0.36"
- egui_extras = { version = "0.36", default-features = false, features = ["svg"] }
- eframe = { version = "0.36", default-features = false }
- egui_kittest = "0.36"
-craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", features = ["serde"] }
++craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", features = ["serde"] }
+ # The application bar as the window's title bar (craft-libs).
-craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", features = ["egui"] }
++craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", features = ["egui"] }
+ egui = "0.37"
+ egui_extras = { version = "0.37", default-features = false, features = ["svg"] }
+ eframe = { version = "0.37", default-features = false }
+ egui_kittest = "0.37"
+ # Monotonic clock on native and web (`Instant`); screenshot settlement must not use wall time.
+ web-time = "1"
rfd = "0.17"
arboard = { version = "3.6", default-features = false }
@@@ -124,9 -126,25 +128,25 @@@ debug =
# Opt-in cancelable macOS termination on the pinned winit 0.30 line.
[patch.crates-io]
- krilla = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.8.2" }
- winit = { git = "https://github.com/storytold/winit.git", rev = "3d51077fd1a966f84df9ef287839dc84fd5b4ca7" }
- hayro = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.7.1" }
- hayro-interpret = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.7.0" }
- hayro-syntax = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.7.2" }
- hayro-jbig2 = { git = "https://github.com/aiongg/craft-libs", rev = "8fbfea8840f0a0f5a22df18901e9db324894b2ce", version = "=0.3.0" }
-krilla = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.8.2" }
++krilla = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.8.2" }
+ winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }
-hayro = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.1" }
-hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.0" }
-hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.2" }
-hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.3.0" }
-hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0" }
-hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0" }
++hayro = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.1" }
++hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.0" }
++hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.2" }
++hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.3.0" }
++hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0" }
++hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0" }
+ ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+ egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
diff --cc ROADMAP.md
index f8a16ce13,6a3696361..d40ddff0d
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -124,10 -155,10 +155,10 @@@ DesignCraft aims at full Adobe InDesig
- View ▸ Rotate Spread (`view.rotateSpread`, `layout.rotateSpreadView`): the spread in view turns in quarter turns on screen (stored with the document; output is unaffected). The canvas maps each spread through its own transform, so tools, snapping, resize handles, guides, overlays and rendering all follow the turned spread.
- Vertical type (Vertical Type Tool, Type ▸ Story Direction `type.storyDirection`, IDML StoryOrientation): the direction belongs to the story, so every frame of a thread is vertical or horizontal together and a frame threaded onto a story takes its direction (`object.textFrameOptions {vertical}` sets the frames' stories); lines run top to bottom and follow each other right to left; the arrow keys follow them (Down and Up along the line, Left and Right to the next and previous line, keeping the position along it); CJK characters stay upright and other text turns, on screen and in PDF; CJK line breaking with basic kinsoku (also in horizontal text); Korean breaks at spaces, word by word (Hangul in any language, hanja in Korean text), or between syllables when the paragraph asks for it (`type.para {koreanCharBreaks}`, Paragraph Style Options ▸ Justification; not written to IDML). Upright text is shaped top to bottom: punctuation and brackets take their vertical forms (OpenType `vert`; `vkrn` and `vpal` through OpenType features), glyphs advance by their vertical metrics (`vmtx`) and hang from their vertical origins (`VORG`) on the centre of the ideographic em box (`BASE`, else OS/2), which the first line's ascent follows; turned text keeps its horizontal forms. Tate-chu-yoko (Type ▸ Tate-Chu-Yoko, `type.tateChuYoko`, IDML `Tatechuyoko`) sets a run such as "12" side by side within one em of the line. Ruby (Type ▸ Ruby…, `type.ruby`, IDML RubyString; group ruby spread 1-2-1 or centred) and kenten emphasis dots (`type.kenten`, IDML KentenKind) are set over their text — to its right in vertical frames — without changing line breaks. Warichu and ruby options (per-character ruby, positions, overhang) aren't there yet.
- Math expressions (Type ▸ Insert Math Expression…, `math.insert`, `math.svg`): a LaTeX subset (fractions, scripts, roots, big operators with limits, Greek, relations and operators with math spacing, `\left…\right`, `\text`) typeset by our own engine into SVG, placed inline at the cursor or as a frame; the LaTeX is kept as alt text and can be edited.
- - Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen; in exported PDFs such graphics go out as 300 ppi images of their visible layers.
+ - Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen; plain and PDF/X-4 exports preserve their visible layers as vectors.
- Effects: Inner Glow (edge or centre), Bevel and Emboss (inner bevel lit from the light angle), Satin (`object.innerGlow`, `object.bevel`, `object.satin`); PDF export now keeps soft effects: objects with shadows, glows, feathers, bevels or satin go out as 300 ppi transparent images of their appearance (threaded text frames excepted).
- Directional Feather (`object.directionalFeather {widths: [top, left, bottom, right]}`): each side fades over its own width.
-- View ▸ Flattener Preview (`view.flattenerPreview`): objects involving transparency highlighted in red; knockout groups export as images (PDF output has no knockout groups).
+- View ▸ Flattener Preview (`view.flattenerPreview`): objects involving transparency highlighted in red; PDF export writes Knockout Group as a knockout transparency group (`/K true`) and Isolate Blending as `/I true`.
- Live captions (`object.caption {live: true}`, Object ▸ Captions ▸ Generate Live Caption): the caption text is re-filled from the source object's metadata after every edit (same undo step).
- Style Export Tagging (`style.exportTag`, Paragraph Style Options ▸ Export Tagging): paragraph and character styles choose their HTML element and class in EPUB/HTML.
- Tagged Text: export (`file.exportText {format: "tagged"}`) and place (detected by its header; ASCII, UTF-8 or UTF-16) with paragraph and character styles, font, typeface and size, and `<0x…>` characters.
@@@ -348,11 -381,43 +381,45 @@@ list) · [roadmap.md](docs/roadmap.md)
Newest first.
+- **2026-10-20** · Print color (craft-libs#190): CMYK print PDFs blend in DeviceCMYK through craft-pdf's print settings instead of byte rewrites, with the CMYK working space as the output intent in PDF/X-4 only; overprint (Overprint Fill, Stroke and Gap, overprinting text, 100% [Black]) is written as `/op` `/OP` `/OPM 1`; Knockout Group writes `/K true` instead of becoming an image; File › Print prints the PDF Export PDF writes. No readiness percentage change.
+- **2026-10-20** · Spot gradients print on their plates. A gradient stop keeps the swatch it was given (Gradient panel drop, `swatch.create {gradient}`, `object.gradient`, IDML `StopColor`), following its renames and edits. PDF export shades one spot with its tints or [Paper] as a Separation, and a spot with process inks or a second spot as DeviceN; a process gradient to [Paper] prints in DeviceCMYK. Documents with plain-color stops export as before. No readiness percentage change.
+ - **2026-10-24** · Panels dock through the suite's shared docking (craft-libs), and on desktop a floating panel opens in its own window that can leave the main window: keys pressed there run the main window's shortcuts, clipboard and tool keys, and the canvas paints no tool cursor while another of the app's windows has the pointer. The web build keeps floating panels in the page. No readiness percentage change.
+ - **2026-10-24** · Story Options rejects malformed or nonexistent explicit story/frame IDs without changing the selected story, including an invalid frame alongside a valid story. Null targets remain absent; omitted targets still use the selection. No readiness percentage change.
+ - **2026-10-24** · Text Frame Options explains that a custom baseline-grid increment must be a measure greater than zero when zero, a negative value or a non-measure is entered. Validation is unchanged. No readiness percentage change.
+ - **2026-10-24** · Renaming a paragraph or character style, or moving it into a style group, keeps its Export Tagging under the new name, and undo puts it back under the old one. Deleting a tagged style drops its tagging and leaves the replacement style's own tagging as it was. No readiness percentage change.
+ - **2026-10-24** · Quick Apply and the application bar's search leave out the interface commands that failed or reset a setting when chosen there: those that need a workspace, a command and shortcut, a menu item, a panel, a window edge, an app page, a recent file or a swatch they can't give them, a Contextual Task Bar place, and Interface Color Theme, UI Scaling, Reset Shortcuts, the flattener preset, Screen Mode and Zoom To, which without a value switched to the dark theme, set 100%, cleared every custom shortcut or the preset, or went to Normal mode or 100% zoom. Each stays in the menu, panel or dialog that gives it the value. No readiness percentage change.
+ - **2026-10-24** · EPUB Export Options › Split Document, a dialog before File › Export EPUB… saves (`document.epubSplit`, stored with the document): off, a single paragraph style, or based on paragraph style export tags, with Paragraph Style Options › Export Tagging's Split Document flag marking those styles. A reflowable EPUB is one content file unless Split Document is on; the split before each top-level h1 from #791 is gone. A split before a list item or preformatted line no longer leaves an unclosed list or block in a content file. IDML import and export keep the setting and the flag, and Load Styles the flag. No readiness percentage change.
+ - **2026-10-18** · Repeated placed-PDF layer variants are prepared once per asset and hidden-name set, with recovery warnings retained. All-visible named layers keep their original source bytes, including PDFs whose cross-reference tables the reader repairs, in plain, PDF/X-4, booklet and book-merge output. Layer changes that require writing still reject an unusable cross-reference table with a file-named damage error; the first placement error is retained (#906). No readiness percentage change.
+ - **2026-10-18** · Placed PDF optional-content defaults and per-frame overrides survive plain and PDF/X-4 vector export, including repeated placements, booklet output and book merging (#906). Source usage-application arrays are accepted; groups without a catalog configuration stay visible. Missing or unreadable default configurations and unsupported base states use all-ON defaults with a file-named export warning, retaining explicit frame overrides. Readable groups omitted from the catalog list are added with a distinct file-named warning, preserving their default ON/OFF states. Concurrent recovery warnings are combined. Malformed ON data is recoverable when a known ON base and empty OFF list prove it cannot hide artwork; missing display names are generated without changing known visibility when no override needs name matching. Contradictory states, unresolved references and ambiguous name overrides still fail export. Print-usage adjustments and IDML layer overrides remain follow-ups. No readiness percentage change.
+
+ - **2026-10-24** · Optical Margin Alignment and hanging punctuation apply to lines with a tab or a right indent tab, as both composers already measured them: the edge glyphs hang, and tab stops stay where they are. Such a line was set without the hang: a justified line that fit only because its period or closing quote hangs had its word spaces squeezed to make up for it, and text after a right indent tab stopped at the measure instead of hanging. No readiness percentage change.
+ - **2026-10-23** · `designcraft-cli mcp` takes `--automation-read-root` and `--automation-write-root` more than once, as the suite's other apps do (#1552): a path inside any root of its kind passes, and the roots' common parent, `..` or a link out of them and the other kind's roots stay refused. No readiness percentage change.
+ - **2026-10-23** · Layout › Go Back and Go Forward (Cmd+Page Up / Cmd+Page Down, Ctrl on Windows and Linux) retrace the jumps between pages (Go to Page, the page and spread commands, the Pages panel) as InDesign's do, returning to where the view was on each page at the current zoom; a new jump after going back drops the pages ahead, scrolling adds no entry, and pages deleted since are skipped. No readiness percentage change.
+ - **2026-10-24** · Split Note (`note.split {story, id, at}`, the Notes panel's Split Note button): as in InDesign, a note splits in two at the insertion point in its text. DesignCraft moves the text after it into a new note by the same author, anchored right after the first. No readiness percentage change.
+ - **2026-10-24** · Type › Notes › Previous Note and Next Note (`note.previous`, `note.next`): as in InDesign, they move the insertion point from note to note in the story, putting the caret after the note's anchor. Each item is unavailable when no note lies in its direction in the story, or when the insertion point is in a table cell or a footnote. No readiness percentage change.
+ - **2026-10-24** · Type › Notes › Convert to Note (`note.convertFromText {author?}`): as in InDesign, the selected text leaves the story and becomes the text of a new note, whose anchor takes its place; Convert Note to Text puts it back. DesignCraft refuses a selection in a table cell, or one that holds a note, footnote, endnote, anchored object, index marker, text anchor, cross-reference or table. No readiness percentage change.
+ - **2026-10-23** · Effects dialog: with Use Global Light on, the Angle field (and the Bevel and Emboss one) stays editable and shows the document's global light angle; a change there sets the global light for every effect that uses it, applied with the effects in one undo step (`object.effects` takes `globalLight`). Before, the field was greyed out and the angle couldn't be changed in the dialog. No readiness percentage change.
+ - **2026-10-24** · Story panel (Window › Type & Tables › Story): Optical Margin Alignment and its size for the stories of the text selection or the selected text frames, disabled without either; `type.selectionAttrs` reports them as `storyOptions`, null where the stories differ. The Paragraph panel menu has Ignore Optical Margin in place of the per-paragraph Optical Margin Alignment switch, which stays in `type.para`, and Paragraph Style Options › Indents and Spacing has Ignore Optical Margin (#947). No readiness percentage change.
+ - **2026-10-24** · Optical Margin Alignment per story with a size (`story.options {opticalMargin, opticalMarginSize}`, off by default): when it is on, the story's paragraphs hang punctuation and letter edges by amounts set for that type size, except paragraphs with Ignore Optical Margin (`ignoreOpticalMargin` in `type.para` and paragraph styles). Table cells and footnotes don't take the story setting yet. When it is off, the per-paragraph switch still hangs at the text's own size. IDML imports and exports both (`StoryPreference/@OpticalMarginAlignment`, `@OpticalMarginSize`, `IgnoreEdgeAlignment`) (#947). No readiness percentage change.
+ - **2026-10-24** · Text frames: a custom baseline grid's Relative To (Text Frame Options › Baseline Options, `object.textFrameOptions {baselineGrid: {relativeTo}}`, IDML `BaselineFrameGridRelativeOption`) measures the grid's start from the top of the page, the top margin, the top of the frame or its top inset. Text Frame Options had no custom baseline grid controls, imports dropped the setting and every frame grid started from the page top, so grid-aligned text in a frame measured from its own top sat on the wrong lines. No readiness percentage change.
+ - **2026-10-24** · Paragraph Style Options › Indents and Spacing has an Align to Grid menu: None, All Lines or First Line Only. It shows the style's current setting. A First Line Only style could be set only in the CJK Grid Settings section, which shows only with CJK features on, or through commands. No readiness percentage change.
+ - **2026-10-24** · Anchored text frames, such as marginal notes, compose where their host story places them: they align to the baseline grid at that position, and page-number markers and spine-relative alignment inside them read the host's page. They composed against a grid measured from their stored position and on no page, so a note set to Only Align First Line to Grid could sit a fraction of a line off the body text's grid line. No readiness percentage change.
+ - **2026-10-24** · Tables: a gradient swatch in a cell fill draws as a gradient on the canvas and in PDF, in one gradient space for the whole table, so it runs across cells without restarting. Cells showed the gradient's first stop as a solid colour. No readiness percentage change.
+ - **2026-10-24** · New documents start with Hyphenate Capitalized Words, Hyphenate Last Word and Hyphenate Across Column off in [Basic Paragraph], as in InDesign. Opened and imported files keep the values they carry. No readiness percentage change.
+ - **2026-10-24** · The baseline grid's Relative To setting applies: with Top Margin, the grid starts at each page's own top margin in text composition, on the canvas and for snapping. It started at the page top, so grid-aligned text sat on the wrong lines and a page could fit one line fewer. No readiness percentage change.
+ - **2026-10-24** · Custom-positioned anchored objects honour Relative to Spine (`anchored.options {spineRelative}`, IDML `SpineRelative`): the settings describe a left-hand page and mirror on a right-hand page, so marginal notes stay in the outside margin on both pages of a spread. On right-hand pages they took the left-hand placement and landed in the inside margin, across the spine or over the body text. No readiness percentage change.
+ - **2026-10-24** · Text frames: a custom baseline grid (Text Frame Options › Baseline Options) from an IDML file sets lines from its start by its increment. The composer read the two values in the other order, so lines landed on the wrong grid. No readiness percentage change.
+ - **2026-10-23** · File › File Info… edits the document's Document Title, Author, Description, Keywords, Copyright Notice and Copyright Info URL (`file.info`), and the document saves them. PDF export (PDF/X-4 and Print Booklet included) writes the title, author, description and keywords into the PDF's document information and XMP. EPUB export takes the title and author from File Info, and HTML export takes the title. A title or author given to the export replaces File Info's, and an empty Document Title leaves the document's name as the title. No readiness percentage change.
+ - **2026-10-23** · Save and export dialogs (Save As, Save a Copy, Export PDF and the other exports, Package, libraries and books) start in the active document's folder once it has been saved, and for a document never saved in the folder of the last file saved or exported, remembered across sessions (#1653). A folder deleted since falls back to the system's choice. No readiness percentage change.
+ - **2026-10-22** · Autoflow (Shift-click with the loaded text cursor, autoflow on Place, `text.thread {autoflow}`) fills the pages that follow before it adds any, as InDesign does: one frame per column on each following page, whatever else the page holds, then new pages at the end of the document. It inserted pages right after the story's last frame, in front of the document's own pages. Frames it set past the end of the text go again; a page the document had stays, and a page autoflow added only for such a frame goes with it. Smart Text Reflow of the primary text frame is unchanged. No readiness percentage change.
- **2026-10-16** · Edit › Keyboard Shortcuts imports a set saved by InDesign's Show Set (.txt, Windows or Mac key names, UTF-8 or UTF-16): matched commands take its Default shortcuts or lose theirs, other commands give up keys it takes, and a report lists what it changed and the items it could not match (`window.importShortcuts`, #1180). Tool keys stay fixed. No readiness percentage change.
+ - **2026-10-23** · Translations: a missing string shows in English and fails no test; `cargo xtask i18n-report`, run by `cargo xtask ci`, prints the missing strings per language. Tests keep duplicate-key and placeholder checks and the language mechanics (lookup, context captions, plural captions, right-to-left). No readiness percentage change.
+ - **2026-10-22** · Hyphenation Settings, as in InDesign: the Paragraph panel menu's Hyphenation… (`app.hyphenationDialog`) sets the selected paragraphs' Hyphenate, Words with at Least, After First, Before Last, Hyphen Limit, Hyphenation Zone, the Better Spacing ↔ Fewer Hyphens slider (InDesign's 0–10 steps), Hyphenate Capitalized Words, Last Word and Across Column, with Preview, as one undo step; Paragraph Style Options › Hyphenation has the same form. The panel menu lists its items in InDesign's order. Replicated from a hyphenation tutorial: the same text in Minion Pro breaks into the same lines as InDesign's with hyphenation on, off, and at Fewer Hyphens. No readiness percentage change.
+ - **2026-10-22** · Hyphenate Across Column (Hyphenation Settings; IDML HyphenateAcrossColumns) is applied: with it off, a paragraph whose line ending in an automatic hyphen would end a column or frame is re-composed without that hyphenation point, so the word moves on whole, as in InDesign. Opened and imported files keep their own setting, so their layouts don't change. No readiness percentage change.
+ - **2026-10-22** · The Paragraph panel is laid out as InDesign's: the nine alignment buttons in groups; indent, spacing and drop cap fields by their icons in two columns, with Space Between Paragraphs Using Same Style (Ignore or a space); Shading and Border with the Paragraph Borders and Shading button and colour; Hyphenate with Do Not Align / Align to Baseline Grid. Its panel menu follows InDesign's order: Paragraph and Single-line Composer, Only Align First Line to Grid, Balance Ragged Lines, Optical Margin Alignment, Justification…, Keep Options…, Span Columns…, Hyphenation…, Drop Caps and Nested Styles…, GREP Styles… (these three now open for the selected paragraphs), Paragraph Rules…, Paragraph Borders and Shading…, Bullets and Numbering…, Restart/Continue Numbering, Define Lists… and the paragraph direction. Convert Bullets and Numbering to Text is listed but not available yet. No readiness percentage change.
- **2026-10-22** · A ruler guide dragged with the Selection tools, out of a ruler, on its own or with other selected guides, snaps along its axis as objects do (#1221): to other ruler guides, margins, columns, bleed, page and object edges and centers (with the smart-guide mark) and the document grid, within the snap zone and following Snap to Guides and Smart Guides. Shift snaps to the ruler's ticks and Cmd suspends snapping. The preview line, the position readout and the drop use the same snapped position. No readiness percentage change.
- **2026-10-22** · macOS: the app menu has a Language submenu after Settings… with each interface language in its own name and the current one checked, as in the suite's other apps; Preferences › General › Interface Language stays. No readiness percentage change.
+ - **2026-10-23** · Type › Text Variables › Convert Variable to Text (`variables.convertToText`): the variable instances in the selected text, in a story, a table cell or a footnote, become plain text of the value each shows on its own page (a running header on page 3 becomes page 3's heading). `variables.convertAllToText {name}` does the same for every instance of one variable in the document, as the Text Variables dialog's Convert to Text button. The variable stays defined; one undo step. No readiness percentage change.
- **2026-10-22** · macOS menu bar: the menus keep working after the interface language or Show CJK Features changes (a rebuilt menu bar lost every click, Quit included), and its key equivalents are the shortcuts in effect, so a shortcut moved in the Keyboard Shortcuts editor leaves its old menu item. No readiness percentage change.
- **2026-10-22** · Paragraph rules: Rule Above's offset is measured from the first line's baseline to the rule's bottom edge, as in InDesign. Rules sat one ascent too high and crossed the previous paragraph's text (reported from an imported INDD document). No readiness percentage change.
- **2026-10-21** · Ruler guides are selected like objects (#1282): a click with the Selection tools selects a guide (also where it crosses an object), Shift-click adds or removes one, a new guide from the rulers is selected, a marquee that touches no object selects the guides it crosses, and Edit › Select All Guides (⌥⌘G, `guide.selectAll`) selects every unlocked guide on the spread. Selected guides draw thicker in their layer's color, drag together (all of them shown moving), nudge with the arrow keys and go with Delete, each as one undo step (`guide.select`, `guide.deselect`, `guide.moveBy`, `guide.delete {}`). With one guide selected the Control bar's X (vertical guide) or Y (horizontal guide) field and Properties › Transform show where it is, as the rulers measure, and typing a value moves it there. No readiness percentage change.
diff --cc crates/engine/src/cmd/export.rs
index e96229a4c,a6dd964eb..808f4d79c
--- a/crates/engine/src/cmd/export.rs
+++ b/crates/engine/src/cmd/export.rs
@@@ -745,11 -810,14 +822,15 @@@ pub(crate) fn pdf_export(s: &Session, p
let doc: &designcraft_doc::Document = &boxed;
let r = designcraft_pdf::export_pdf_with_report(doc, &s.cache, &opts).map_err(|e| EngineError::Other(e.to_string()))?;
let mut r = r;
+ // Flattening and effect rasterization replace placements, so inspect the source too.
+ if st.doc.has_graphic_layer_visibility_overrides() && !r.warnings.iter().any(|w| w == designcraft_doc::GRAPHIC_LAYER_RENDERING_WARNING) {
+ r.warnings.push(designcraft_doc::GRAPHIC_LAYER_RENDERING_WARNING.into());
+ }
- // Transparency Blend Space: the page group of pages with transparency.
+ // Transparency Blend Space: the page group of pages with transparency. CMYK print output
+ // gets its CMYK page groups from the writer.
let spreads = designcraft_pdf::sheet_spreads(doc, &opts);
let blended: Vec<bool> = spreads.iter().map(|si| doc.spreads.get(*si).is_some_and(|sp| sp.items.iter().any(|it| transparent(it)))).collect();
- if blended.iter().any(|b| *b) {
+ if !designcraft_pdf::print_color(doc, &opts) && blended.iter().any(|b| *b) {
match designcraft_pdf::add_blend_space(&r.bytes, &blended, doc.settings.blend_space == designcraft_doc::BlendSpace::Cmyk) {
Some(b) => r.bytes = b,
None => r.warnings.push("the transparency blend space couldn't be set".into()),
@@@ -818,9 -888,193 +901,187 @@@
{
r.warnings.push(format!("transparency flattened: {n} region(s) rasterised"));
}
- match str_param(p, "path") {
- Some(path) => {
- write_file(path, &r.bytes)?;
- Ok(json!({"path": path, "bytes": r.bytes.len(), "pages": r.pages, "warnings": r.warnings}))
- }
- None => Ok(json!({"base64": super::base64_encode(&r.bytes), "bytes": r.bytes.len(), "pages": r.pages, "warnings": r.warnings})),
- }
+ Ok(r)
}
+ #[cfg(test)]
+ mod placed_layer_tests {
+ use std::sync::Arc;
+
+ use designcraft_doc::{AnchoredObject, Document, Item, ItemId, SpreadRef, StoryId, Table};
+ use designcraft_geom::Rect;
+ use serde_json::json;
+
+ use crate::Session;
+
+ fn two_layer_pdf() -> Vec<u8> {
+ let content = "/OC /a BDC 0 0 1 rg 0 0 50 100 re f EMC /OC /b BDC 1 0 0 rg 50 0 50 100 re f EMC";
+ let objs = [
+ "<</Type/Catalog/Lang(en-GB)/Pages 2 0 R/OCProperties<</OCGs[5 0 R 6 0 R]/D<</Order[5 0 R 6 0 R]/Name(Default)/Locked[5 0 R]>>>>>>"
+ .to_string(),
+ "<</Type/Pages/Kids[3 0 R]/Count 1>>".to_string(),
+ "<</Type/Page/Parent 2 0 R/MediaBox[0 0 100 100]/Resources<</Properties<</a 5 0 R/b 6 0 R>>>>/Contents 4 0 R>>".to_string(),
+ format!("<</Length {}>>\nstream\n{content}\nendstream", content.len()),
+ "<</Type/OCG/Name(Blue)>>".to_string(),
+ "<</Type/OCG/Name(Red)>>".to_string(),
+ ];
+ let mut out = b"%PDF-1.7\n".to_vec();
+ let mut offs = Vec::new();
+ for (i, o) in objs.iter().enumerate() {
+ offs.push(out.len());
+ out.extend_from_slice(format!("{} 0 obj\n{}\nendobj\n", i + 1, o).as_bytes());
+ }
+ let x = out.len();
+ let mut t = format!("xref\n0 {}\n0000000000 65535 f\r\n", objs.len() + 1);
+ for o in offs {
+ t.push_str(&format!("{o:010} 00000 n\r\n"));
+ }
+ t.push_str(&format!("trailer\n<</Size {}/Root 1 0 R>>\nstartxref\n{x}\n%%EOF\n", objs.len() + 1));
+ out.extend_from_slice(t.as_bytes());
+ out
+ }
+
+ fn placement<'a>(d: &'a Document, location: &str, id: ItemId, sid: StoryId) -> &'a Item {
+ match location {
+ "cell" => &d.story(sid).unwrap().tables.values().next().unwrap().cells[0].text.objects[0].item,
+ "footnote" => &d.story(sid).unwrap().notes[0].text.objects[0].item,
+ "endnote" => &d.story(sid).unwrap().endnotes[0].text.objects[0].item,
+ "anchor" => &d.story(sid).unwrap().objects[0].item,
+ _ => d.item(id).unwrap(),
+ }
+ }
+
+ #[test]
+ fn stale_layer_fields_on_non_pdf_placements_do_not_block_pdf_a() {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({})).unwrap();
+ let result = s
+ .execute(
+ "file.place",
+ &json!({
+ "base64": super::super::file::base64_encode(&two_layer_pdf()), "name": "layers.pdf",
+ }),
+ )
+ .unwrap();
+ let id = ItemId(result["id"].as_u64().unwrap());
+ s.execute("object.layerOptions", &json!({"ids": [id.0], "hidden": ["Blue"]})).unwrap();
+ // Relinking to an ordinary image can leave legacy fields on the placement.
+ // They are not an actionable placed-PDF override and must not fail closed.
+ let d = Arc::make_mut(&mut s.doc_mut().unwrap().doc);
+ let aid = d.item(id).unwrap().graphic().unwrap().asset;
+ let asset = Arc::make_mut(d.assets.get_mut(&aid).unwrap());
+ asset.mime = "image/png".into();
+ asset.data = Arc::new(designcraft_render::Rendered { width: 1, height: 1, pixels: vec![0, 0, 0, 0] }.to_png());
+ let (copy, count) = super::rasterize_layered(d).unwrap();
+ assert_eq!(count, 0);
+ assert!(copy.is_none());
+ s.execute("file.exportPdf", &json!({"standard": "a2b"})).unwrap();
+ }
+
+ fn check_placement(location: &str) {
+ for all_on in [false, true] {
+ check_choice(location, all_on);
+ }
+ }
+
+ fn check_choice(location: &str, all_on: bool) {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({"width": 100, "height": 100, "pages": 1})).unwrap();
+ let placed = s
+ .execute(
+ "file.place",
+ &json!({
+ "base64": super::super::file::base64_encode(&two_layer_pdf()), "name": "layers.pdf",
+ "x": 0, "y": 0, "width": 100,
+ "spread": {"kind": if location == "parent" { "parent" } else { "doc" }, "index": 0}
+ }),
+ )
+ .unwrap();
+ let id = ItemId(placed["id"].as_u64().unwrap());
+ let hidden = if all_on { vec![] } else { vec!["Blue"] };
+ s.execute("object.layerOptions", &json!({"ids": [id.0], "hidden": hidden, "useDefaults": false})).unwrap();
+ let sid = {
+ let d = Arc::make_mut(&mut s.doc_mut().unwrap().doc);
+ let layer = d.default_layer();
+ let (_, sid) = d.add_text_frame(SpreadRef::Doc(0), Rect::new(0.0, 0.0, 80.0, 80.0), layer, "Body", Default::default()).unwrap();
+ if !matches!(location, "doc" | "parent") {
+ let item = (**d.spreads[0].items.iter().find(|it| it.id == id).unwrap()).clone();
+ Arc::make_mut(&mut d.spreads[0]).items.retain(|it| it.id != id);
+ let object = AnchoredObject { item, position: Default::default() };
+ let story = d.story_mut(sid).unwrap();
+ match location {
+ "cell" => {
+ let mut table = Table::new(1, 1, 1, 0, 0, 20.0);
+ table.cells[0].text.insert_object(0, object);
+ story.insert_table(0, table);
+ }
+ "footnote" => {
+ story.insert_note(0, "Note", Default::default()).unwrap();
+ Arc::make_mut(&mut story.notes[0]).text.insert_object(0, object);
+ }
+ "endnote" => {
+ story.insert_endnote(0, "Endnote", Default::default()).unwrap();
+ Arc::make_mut(&mut story.endnotes[0]).text.insert_object(0, object);
+ }
+ "anchor" => story.insert_object(0, object),
+ _ => assert!(matches!(location, "doc" | "parent")),
+ }
+ }
+ sid
+ };
+ // Exercise the real export command for each location, not just the traversal helper.
+ let result = s.execute("file.exportPdf", &json!({"standard": "a2b"})).unwrap();
+ assert!(
+ result["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("1 placed PDF(s)")),
+ "{location}: {}",
+ result["warnings"]
+ );
+ // Check the rewritten placement, including its pixels. Counting a placement without
+ // updating the nested object would still export the file's default layer visibility.
+ let source = &s.doc().unwrap().doc;
+ let (copy, count) = super::rasterize_layered(source).unwrap();
+ assert_eq!(count, 1, "{location}");
+ let copy = copy.unwrap();
+ let item = placement(&copy, location, id, sid);
+ let asset = &copy.assets[&item.graphic().unwrap().asset];
+ assert_eq!(asset.mime, "image/png", "{location}");
+ let image = designcraft_render::images::decoded(&asset.data, 0);
+ let image = image.unwrap();
+ let pixel = image.data()[usize::from(image.height()) / 2 * usize::from(image.width()) + usize::from(image.width()) / 4];
+ assert_eq!(pixel.a, if all_on { 255 } else { 0 }, "Blue visibility at {location}, all_on={all_on}");
+ // Export preparation must not change the open document's placement or source asset.
+ let original = placement(source, location, id, sid);
+ assert_eq!(original.pdf_hidden_layers, hidden);
+ assert!(original.pdf_layer_override);
+ assert_eq!(source.assets[&original.graphic().unwrap().asset].mime, "application/pdf");
+ }
+
+ #[test]
+ fn layered_pdf_a_document_placement() {
+ check_placement("doc");
+ }
+ #[test]
+ fn layered_pdf_a_parent_placement() {
+ check_placement("parent");
+ }
+ #[test]
+ fn layered_pdf_a_story_anchor() {
+ check_placement("anchor");
+ }
+ #[test]
+ fn layered_pdf_a_table_cell_anchor() {
+ check_placement("cell");
+ }
+ #[test]
+ fn layered_pdf_a_footnote_anchor() {
+ check_placement("footnote");
+ }
+ #[test]
+ fn layered_pdf_a_endnote_anchor() {
+ check_placement("endnote");
+ }
+ }
+
#[cfg(not(target_arch = "wasm32"))]
fn write_file(path: &str, bytes: &[u8]) -> Result<()> {
crate::io::write_file(path, bytes).map_err(EngineError::Other)
diff --cc crates/engine/src/cmd/print.rs
index 7e5fd3515,8283dcf0a..e71c230de
--- a/crates/engine/src/cmd/print.rs
+++ b/crates/engine/src/cmd/print.rs
@@@ -95,64 -98,30 +98,56 @@@ mod tests
fn print_submits_the_selected_export_and_reports_refusal() {
let mut s = Session::new();
s.execute("file.new", &json!({"pages": 4})).unwrap();
- let params = json!({"printer": "Office (east)", "copies": 2, "pages": "2-3", "marks": true, "bleed": true});
- // The production export options and full bytes reach the shared spooler boundary. The
- // creation date is in whole seconds: an attempt can straddle a second boundary.
- let mut matched = false;
- for _ in 0..3 {
- let expected = super::super::export::pdf_export(&s, &params).unwrap().bytes;
- let mut printed = Vec::new();
- let r = print_with(&mut s, &params, |pdf, job| {
- printed = pdf.to_vec();
- assert!(pdf.starts_with(b"%PDF-"));
- assert_eq!(job.printer.as_deref(), Some("Office (east)"));
- assert_eq!(job.copies, 2);
- assert_eq!(job.duplex, None);
- assert_eq!(job.scaling, craft_print::Scaling::ShrinkToFit);
- assert!(!job.title.is_empty());
- Ok("request id is Office-1".into())
- })
- .unwrap();
- assert_eq!(r["pages"], 2);
- if printed == expected {
- matched = true;
- break;
- }
- }
- assert!(matched, "File › Print spools the selected export's bytes");
+ // A fixed creation date: both exports would otherwise take the clock's second.
+ let params = json!({"printer": "Office (east)", "copies": 2, "pages": "2-3", "marks": true, "bleed": true, "created": 1_700_000_000});
- let expected = {
- let d = &s.doc().unwrap().doc;
- let options = super::super::export::options(&params, d.page_count()).unwrap();
- designcraft_pdf::export_pdf(&super::super::interchange::with_pdf_boxes(d), &s.cache, &options).unwrap()
- };
++ let expected = super::super::export::pdf_export(&s, &params).unwrap().bytes;
+ let r = print_with(&mut s, &params, |pdf, job| {
+ // The production export options and full bytes reach the shared spooler boundary.
+ assert_eq!(pdf, expected);
+ assert!(pdf.starts_with(b"%PDF-"));
+ assert_eq!(job.printer.as_deref(), Some("Office (east)"));
+ assert_eq!(job.copies, 2);
+ assert_eq!(job.duplex, None);
+ assert_eq!(job.scaling, craft_print::Scaling::ShrinkToFit);
+ assert!(!job.title.is_empty());
+ Ok("request id is Office-1".into())
+ })
+ .unwrap();
+ assert_eq!(r["pages"], 2);
let refusal = print_with(&mut s, &params, |_, _| Err(craft_print::Error::Spool("printer offline".into()))).unwrap_err();
assert!(refusal.to_string().contains("printer offline"));
print_with(&mut s, &json!({"dryRun": true}), |_, _| panic!("dry runs must not spool")).unwrap();
assert!(print_with(&mut s, &json!({"pages": "9"}), |_, _| panic!("invalid ranges must not spool")).is_err());
+ assert!(print_with(&mut s, &json!({"created": "today"}), |_, _| panic!("an invalid date must not spool")).is_err());
}
+
+ /// File › Print spools the PDF that File › Export PDF writes with the same settings: soft
+ /// effects as images, CMYK print color, the same warnings.
+ #[test]
+ fn print_spools_what_export_pdf_writes() {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({})).unwrap();
+ let id = s.execute("frame.create", &json!({"rect": [72, 72, 200, 200]})).unwrap()["id"].clone();
+ s.execute("object.fill", &json!({"ids": [id], "swatch": "C=100 M=0 Y=0 K=0"})).unwrap();
+ s.execute("object.dropShadow", &json!({"ids": [id], "on": true, "distance": 8, "size": 6})).unwrap();
+ let params = json!({"standard": "x4"});
+ // The creation date is in whole seconds: an attempt can straddle a second boundary.
+ let mut matched = false;
+ for _ in 0..3 {
+ let exported = s.execute("file.exportPdf", &params).unwrap();
+ let mut printed = Vec::new();
+ let r = print_with(&mut s, &params, |pdf, _| {
+ printed = pdf.to_vec();
+ Ok("request id is Office-1".into())
+ })
+ .unwrap();
+ assert_eq!(r["warnings"], exported["warnings"]);
+ assert!(r["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("soft effects")), "{r}");
+ if printed == super::super::file::base64_decode(exported["base64"].as_str().unwrap()) {
+ matched = true;
+ break;
+ }
+ }
+ assert!(matched, "File › Print spools Export PDF's bytes");
+ }
}
diff --cc crates/pdf/src/export.rs
index 381df8bde,0099e9b36..86e0f90e0
--- a/crates/pdf/src/export.rs
+++ b/crates/pdf/src/export.rs
@@@ -141,35 -138,39 +145,47 @@@ pub fn export_pdf_with_report(doc: &Doc
write::guard(|| export_pdf_with_report_inner(doc, cache, opts))
}
+ /// Form fields (Buttons and Forms) and, for interactive PDF, video and sound; not in PDF/X
+ /// or PDF/A: this update comes after krilla's validator ran, and its NeedAppearances fields and
+ /// Screen annotations aren't allowed in PDF/A.
+ fn add_form_fields(bytes: &mut Vec<u8>, warnings: &mut Vec<String>, doc: &Document, sheets: &[Sheet], opts: &PdfOptions) {
+ let fields = crate::forms::collect(doc, sheets);
+ let media = if opts.media { crate::forms::collect_media(doc, sheets) } else { Vec::new() };
+ if fields.is_empty() && media.is_empty() {
+ return;
+ }
+ match opts.standard {
+ Standard::PdfX4 => warnings.push("PDF/X-4: form fields and media were left out".into()),
+ Standard::PdfA2b => warnings.push("PDF/A-2b: form fields and media were left out".into()),
+ _ => match crate::forms::add_fields(&*bytes, &fields, &media) {
+ Some(b) => *bytes = b,
+ None => warnings.push("form fields and media couldn't be added to this PDF".into()),
+ },
+ }
+ }
+
fn export_pdf_with_report_inner(doc: &Document, cache: &Cache, opts: &PdfOptions) -> Result<ExportReport> {
let sheets = sheets(doc, opts)?;
- let warnings = Vec::new();
let (version, archival) = match opts.standard {
Standard::None => (PdfVersion::Pdf17, None),
Standard::PdfX4 => (PdfVersion::Pdf16, None),
Standard::PdfA2b => (PdfVersion::Pdf17, Some(Archival::A2_B)),
};
let configuration = write::configuration(version, archival)?;
- let settings = krilla::SerializeSettings { compress_content_streams: opts.compress, configuration, ..Default::default() };
+ let mut warnings = Vec::new();
+ let base = if print_color(doc, opts) {
+ // An output intent only for PDF/X, as in InDesign.
+ let (settings, warning) = crate::pdfx::print_settings(opts.standard == Standard::PdfX4)?;
+ warnings.extend(warning);
+ let pdfx_version = (opts.standard == Standard::PdfX4).then(|| "PDF/X-4".to_string());
+ krilla::SerializeSettings { pdfx_version, ..settings }
+ } else {
+ krilla::SerializeSettings::default()
+ };
+ let settings = krilla::SerializeSettings { compress_content_streams: opts.compress, configuration, ..base };
let title = opts.title.clone().unwrap_or_else(|| doc.title.clone());
let created = opts.created.or_else(now_unix);
- let metadata = Metadata {
- creator: "DesignCraft".into(),
- producer: "DesignCraft".into(),
- title: Some(title.clone()),
- authors: opts.author.iter().cloned().collect(),
- created: created.map(date_time),
- ..Default::default()
- };
+ let metadata = Metadata { created: created.map(date_time), ..file_info_metadata(doc, opts.title.as_deref(), opts.author.as_deref()) };
- let meta_title = metadata.title.clone().unwrap_or_default();
let mut writer = Writer::new(settings, metadata);
let pdf = writer.document_mut();
@@@ -243,30 -249,26 +264,20 @@@
pdf.set_tag_tree(ex.tag_tree());
}
ex.check_placed_versions()?;
+ if let Some(error) = ex.layer_error {
+ return Err(error);
+ }
let mut bytes = writer.finish().map_err(PdfError::from)?;
- // Transparency blends in the document's blend space: CMYK for print (and always in PDF/X).
let mut warnings = ex.warnings;
- // Form fields (Buttons and Forms) and, for interactive PDF, video and sound; not in PDF/X
- // or PDF/A: this update comes after krilla's validator ran, and its NeedAppearances fields and
- // Screen annotations aren't allowed in PDF/A.
- let fields = crate::forms::collect(doc, &sheets);
- let media = if opts.media { crate::forms::collect_media(doc, &sheets) } else { Vec::new() };
- if !fields.is_empty() || !media.is_empty() {
- if opts.standard == Standard::PdfX4 {
- warnings.push("PDF/X-4: form fields and media were left out".into());
- } else if opts.standard == Standard::PdfA2b {
- warnings.push("PDF/A-2b: form fields and media were left out".into());
- } else {
- match crate::forms::add_fields(&bytes, &fields, &media) {
- Some(b) => bytes = b,
- None => warnings.push("form fields and media couldn't be added to this PDF".into()),
- }
- }
- if !ex.rgb_only && (doc.settings.blend_space == designcraft_doc::BlendSpace::Cmyk || opts.standard == Standard::PdfX4) {
- // The rewrite matches krilla's exact output; in PDF/X-4, `check_pdfx4` reports any
- // group that got past it, with its page.
- crate::pdfx::cmyk_group_spaces(&mut bytes);
- }
+ if ex.has_optional_content {
+ bytes = crate::optional_content::register(&bytes)?;
}
+ add_form_fields(&mut bytes, &mut warnings, doc, &sheets, opts);
if opts.standard == Standard::PdfX4 {
- // Output intent and PDF/X identification, then check the result.
- match crate::pdfx::make_pdfx4(&bytes, &meta_title, created) {
+ // The XMP dates krilla doesn't write, then check the result.
+ match crate::pdfx::make_pdfx4(&bytes, created) {
Some(b) => bytes = b,
- None => warnings.push("PDF/X-4: the output intent couldn't be added".into()),
+ None => warnings.push("PDF/X-4: the XMP metadata date couldn't be added".into()),
}
for issue in crate::pdfx::check_pdfx4(&bytes) {
warnings.push(format!("PDF/X-4: {issue}"));
@@@ -349,17 -355,8 +364,16 @@@ fn export_booklet_inner(doc: &Document
return Err(PdfError::NoPages);
}
let pdf_opts = PdfOptions { title: opts.title.clone(), ..PdfOptions::default() };
- let settings = krilla::SerializeSettings { compress_content_streams: true, ..Default::default() };
+ let mut warnings = Vec::new();
+ let base = if print_color(doc, &pdf_opts) {
+ let (settings, warning) = crate::pdfx::print_settings(false)?;
+ warnings.extend(warning);
+ settings
+ } else {
+ krilla::SerializeSettings::default()
+ };
+ let settings = krilla::SerializeSettings { compress_content_streams: true, ..base };
- let title = opts.title.clone().unwrap_or_else(|| doc.title.clone());
- let metadata = Metadata { creator: "DesignCraft".into(), producer: "DesignCraft".into(), title: Some(title), ..Default::default() };
+ let metadata = file_info_metadata(doc, opts.title.as_deref(), None);
let mut writer = Writer::new(settings, metadata);
let pdf = writer.document_mut();
let mut ex = Exporter {
@@@ -423,7 -425,16 +442,13 @@@
page.finish();
}
ex.check_placed_versions()?;
- let bytes = writer.finish().map_err(PdfError::from)?;
+ if let Some(error) = ex.layer_error {
+ return Err(error);
+ }
+ let mut bytes = writer.finish().map_err(PdfError::from)?;
- if doc.settings.blend_space == designcraft_doc::BlendSpace::Cmyk {
- crate::pdfx::cmyk_group_spaces(&mut bytes);
- }
+ if ex.has_optional_content {
+ bytes = crate::optional_content::register(&bytes)?;
+ }
let mut warnings = ex.warnings;
warnings.dedup();
Ok(ExportReport { bytes, pages: pairs.len(), warnings })
diff --cc crates/pdf/src/lib.rs
index 26dd69e25,84e4a954f..c14b77f99
--- a/crates/pdf/src/lib.rs
+++ b/crates/pdf/src/lib.rs
@@@ -41,12 -35,11 +41,13 @@@ mod marks
mod text;
mod forms;
+ mod optional_content;
mod pdfx;
mod transitions;
-pub use export::{BookletKind, BookletOptions, booklet_pairs, export_booklet, export_pdf, export_pdf_with_report, merge_pdfs, sheet_spreads};
-pub use pdfx::{check_pdfx4, cmyk_group_spaces, has_rgb_groups, make_pdfx4};
+pub use export::{
+ BookletKind, BookletOptions, booklet_pairs, export_booklet, export_pdf, export_pdf_with_report, merge_pdfs, print_color, sheet_spreads,
+};
+pub use pdfx::{check_pdfx4, has_rgb_groups, make_pdfx4};
pub use transitions::{add_blend_space, add_catalog_entries, add_page_entries, add_transitions};
/// PDF standard to target.
diff --cc crates/pdf/src/pdfx.rs
index c37cfbd26,5566353fd..4aa785540
--- a/crates/pdf/src/pdfx.rs
+++ b/crates/pdf/src/pdfx.rs
@@@ -9,50 -8,30 +9,52 @@@ use hayro_syntax::content::UntypedIter
use hayro_syntax::object::{Array, Dict, Name, Object, ObjectIdentifier, Stream};
use hayro_syntax::page::Resources;
+use craft_pdf::write::WriteError;
+use craft_pdf::write::backend as krilla;
+use craft_pdf::write::print::{self, PrintColor};
+
use crate::transitions::{find, int_after, object, rfind};
+ mod fonts;
+
-/// Escape a PDF literal string.
-fn lit(s: &str) -> String {
- let mut o = String::from("(");
- for c in s.chars() {
- if matches!(c, '(' | ')' | '\\') {
- o.push('\\');
+/// The serialization settings for CMYK print output: DeviceCMYK and CMYK blending groups in the
+/// document's CMYK working space (Coated FOGRA39 when it has none or its profile can't be
+/// written). With `intent` (PDF/X), the working space is also the `GTS_PDFX` output intent, with
+/// `/Trapped /False`. The second value is a warning when the working space's profile was replaced.
+pub(crate) fn print_settings(intent: bool) -> crate::Result<(krilla::SerializeSettings, Option<String>)> {
+ print_settings_with(&designcraft_color::cms::active(), intent)
+}
+
+/// [`print_settings`] for the working spaces of `cms`.
+pub(crate) fn print_settings_with(cms: &designcraft_color::cms::Cms, intent: bool) -> crate::Result<(krilla::SerializeSettings, Option<String>)> {
+ let write = |color: PrintColor<'_>| if intent { print::settings(color) } else { print::cmyk_blending(color.profile) };
+ let fogra39 = || write(PrintColor::fogra39(craft_cms::builtin::COATED_FOGRA39_ICC));
+ let Ok(space) = cms.output_intent() else { return Ok((fogra39()?, None)) };
+ let registered = space.identifier != "Custom";
+ let color = PrintColor {
+ profile: &space.icc,
+ condition_identifier: space.identifier,
+ condition: Some(&space.condition),
+ registry_name: registered.then_some("http://www.color.org"),
+ info: Some(&space.condition),
+ };
+ match write(color) {
+ Ok(settings) => Ok((settings, None)),
+ Err(WriteError::InvalidProfile) => {
+ Ok((fogra39()?, Some(format!("the CMYK working space `{}` couldn't be written to the PDF; Coated FOGRA39 was used", space.condition))))
}
- o.push(c);
+ Err(e) => Err(e.into()),
}
- o.push(')');
- o
}
-/// Turn krilla's output into PDF/X-4. `date` (Unix seconds, UTC) is the XMP metadata date; `None`
-/// (no clock, as on wasm) writes the epoch, because PDF/X-4 requires the entry. `None` back when
-/// the file isn't the simple kind this understands (a classic cross-reference table and plain
-/// dictionaries).
-pub fn make_pdfx4(pdf: &[u8], title: &str, date: Option<i64>) -> Option<Vec<u8>> {
+/// Finish krilla's PDF/X-4 output with the XMP entries PDF/X-4 requires and krilla doesn't write:
+/// `xmp:MetadataDate` and `xmpMM:VersionID`, as an incremental update. `date` (Unix seconds, UTC)
+/// is the metadata date; `None` (no clock, as on wasm) writes the epoch. `None` back when the
+/// file isn't the simple kind this understands (a classic cross-reference table, uncompressed
+/// XMP).
+pub fn make_pdfx4(pdf: &[u8], date: Option<i64>) -> Option<Vec<u8>> {
let t_at = rfind(pdf, b"trailer")?;
- let trailer = String::from_utf8_lossy(&pdf[t_at..]).to_string();
+ let trailer = String::from_utf8_lossy(pdf.get(t_at..)?).to_string();
let size = int_after(&trailer, "/Size")?;
let root = int_after(&trailer, "/Root")?;
let prev = int_after(&trailer, "startxref")?;
@@@ -571,6 -680,18 +583,18 @@@ mod tests
out
}
+ /// A metadata object whose only `stream` is the one inside `endstream` is refused, not a slice panic.
+ #[test]
+ fn metadata_with_only_endstream_does_not_panic() {
+ let objects = ["<</Type/Catalog/Pages 2 0 R/Metadata 3 0 R>>", "<</Type/Pages/Kids[]/Count 0>>", "<</Type/Metadata>>endstream"];
+ let mut out = b"%PDF-1.6\n".to_vec();
+ for (i, o) in objects.iter().enumerate() {
+ out.extend_from_slice(format!("{} 0 obj\n{o}\nendobj\n", i + 1).as_bytes());
+ }
+ out.extend_from_slice(b"trailer\n<</Size 4/Root 1 0 R>>\nstartxref\n0\n%%EOF\n");
- assert!(super::make_pdfx4(&out, "t", None).is_none());
++ assert!(super::make_pdfx4(&out, None).is_none());
+ }
+
/// DeviceRGB is allowed when a `DefaultRGB` colour space makes it colour-managed.
#[test]
fn default_rgb_makes_device_rgb_managed() {
diff --cc docs/pdf-backend.md
index 4cbc985d3,eb32303a9..c6e65754e
--- a/docs/pdf-backend.md
+++ b/docs/pdf-backend.md
@@@ -1,8 -1,8 +1,8 @@@
# Shared PDF backend
- DesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the four Hayro reader crates to
- craft-libs revision `89dcbb3060377a26c99a6d80caa16084366704c4`. Existing `craft-ui` and `craft-print` revisions
- remain unchanged. The reader migration is reviewed on top of the separate writer change.
+ DesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the six Hayro reader crates (with
-`hayro-cmap` and `hayro-postscript`) to craft-libs revision `a0916808f7d78bed8c7b90cdf937176015454a7f`. `craft-ui`,
++`hayro-cmap` and `hayro-postscript`) to craft-libs revision `e3b9e239c52c14677be462e94d8920ea243de4f3`. `craft-ui`,
+ `craft-print` and the other craft-libs crates are pinned to the same revision. The reader migration is reviewed on top of the separate writer change.
## Writing
diff --cc docs/target-app-parity.md
index a38352b64,428ed9bf7..1f3d8ec74
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@@ -317,9 -324,9 +324,9 @@@ It is evidence of breadth: each item ex
- Object ▸ Generate QR Code (`object.qrCode`: web link, text, SMS, email, business card; vector modules as a compound path, into a frame or re-encoded in place).
- Conditional text (`condition.new/options/delete/apply/list`, Conditional Text panel): hidden conditions drop their text from layout and exports, indicators underline on screen, IDML Condition/AppliedConditions.
- Endnotes (`endnote.insert/edit/delete/list/options`, Type ▸ Insert Endnote): references number through the document, the endnote frame on a new last page lists them under a heading; IDML keeps the listed text only.
- - Editorial notes (`note.new/edit/delete/convertToText/list`, Notes panel): anchored in text, flagged on screen, never printed or exported.
+ - Editorial notes (`note.new/edit/delete/convertToText/convertFromText/split/list`, Notes panel with Split Note, Type › Notes › Convert to Note): anchored in text, flagged on screen, never printed or exported.
- File ▸ Print Booklet (`file.printBooklet`): saddle-stitch or 2-up consecutive printer spreads as PDF, padded with blanks, with a gap between pages.
-- Edit ▸ Transparency Blend Space (`edit.transparencyBlendSpace`; RGB for web/mobile documents; IDML TransparencyPreference) — exported PDFs give pages with transparency a DeviceCMYK or DeviceRGB page group, so viewers and RIPs blend in that space. On screen, CMYK spreads with separable blend modes use two ink-channel passes through the working colour settings. Parent-page items, nested groups, effects and pasteboard share that path; 100% K in Color Dodge whitens coloured areas while paper stays outside the blend backdrop. Effect blend layers sit outside their clips and offscreen filters, preserving their backdrop in RGB too. The pass count is independent of blended-object count, and unchanged viewports reuse one cached raster (64 MiB cap). Spreads containing Hue, Saturation, Color or Luminosity still use the existing RGB blend followed by a CMYK proof approximation; full nonseparable CMYK blending remains open.
+- Edit ▸ Transparency Blend Space (`edit.transparencyBlendSpace`; RGB for web/mobile documents; IDML TransparencyPreference) — exported PDFs blend in that space: CMYK print exports write their transparency groups and page groups in DeviceCMYK (PDF/X-4 also carries the CMYK working space as its `GTS_PDFX` output intent); RGB exports give pages with transparency a DeviceRGB page group. On screen, CMYK spreads with separable blend modes use two ink-channel passes through the working color settings. Parent-page items, nested groups, effects and pasteboard share that path; 100% K in Color Dodge whitens colored areas while paper stays outside the blend backdrop. Effect blend layers sit outside their clips and offscreen filters, preserving their backdrop in RGB too. The pass count is independent of blended-object count, and unchanged viewports reuse one cached raster (64 MiB cap). Spreads containing Hue, Saturation, Color or Luminosity still use the existing RGB blend followed by a CMYK proof approximation; full nonseparable CMYK blending remains open.
- High Contrast interface theme (fifth Interface Color Theme: black chrome, white text, yellow selection).
- Place Excel workbooks (.xlsx): the first worksheet's used range becomes a table (shared/inline strings, numbers, booleans).
- Object Library (`library.new/open/add/place/remove/list/json/close`, Library panel): `.dclib` files of snippets that keep stories, styles, swatches and images.
@@@ -387,12 -394,14 +394,14 @@@
- View ▸ Rotate Spread (`view.rotateSpread`, `layout.rotateSpreadView`): the spread in view turns in quarter turns on screen (stored with the document and in IDML's spread transform; output is unaffected). The canvas maps each spread through its own transform, so tools, snapping, resize handles, guides, overlays and rendering all follow the turned spread.
- Vertical type (Vertical Type Tool, Type ▸ Story Direction `type.storyDirection`, IDML StoryOrientation): the direction belongs to the story, so every frame of a thread is vertical or horizontal together and a frame threaded onto a story takes its direction (`object.textFrameOptions {vertical}` sets the frames' stories); lines run top to bottom and follow each other right to left; the arrow keys follow them (Down and Up along the line, Left and Right to the next and previous line, keeping the position along it); CJK characters stay upright and other text turns, on screen and in PDF; CJK line breaking with basic kinsoku (also in horizontal text); Korean breaks at spaces, word by word (Hangul in any language, hanja in Korean text), or between syllables when the paragraph asks for it (`type.para {koreanCharBreaks}`, Paragraph Style Options ▸ Justification; not written to IDML). Upright text is shaped top to bottom: punctuation and brackets take their vertical forms (OpenType `vert`; `vkrn` and `vpal` through OpenType features), glyphs advance by their vertical metrics (`vmtx`) and hang from their vertical origins (`VORG`) on the centre of the ideographic em box (`BASE`, else OS/2), which the first line's ascent follows; turned text keeps its horizontal forms. Tate-chu-yoko (Type ▸ Tate-Chu-Yoko, `type.tateChuYoko`, IDML `Tatechuyoko`) sets a run such as "12" side by side within one em of the line. Ruby (Type ▸ Ruby…, `type.ruby`, IDML RubyString; group ruby spread 1-2-1 or centred) and kenten emphasis dots (`type.kenten`, IDML KentenKind) are set over their text — to its right in vertical frames — without changing line breaks. Warichu and ruby options (per-character ruby, positions, overhang) aren't there yet.
- Math expressions (Type ▸ Insert Math Expression…, `math.insert`, `math.svg`): a LaTeX subset (fractions, scripts, roots, big operators with limits, Greek, relations and operators with math spacing, `\left…\right`, `\text`) typeset by our own engine into SVG, placed inline at the cursor or as a frame; the LaTeX is kept as alt text and can be edited.
- - Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen; in exported PDFs such graphics go out as 300 ppi images of their visible layers.
+ - Object Layer Options for placed PDFs (`object.pdfLayers`, `object.layerOptions`, Object ▸ Object Layer Options…): the file's optional-content layers listed and shown or hidden per frame on screen. Plain and PDF/X-4 exports retain vector artwork and optional content with the source defaults or per-frame overrides, including independent states for repeated placements. Missing or unreadable default configurations and unsupported base states fall back to all-ON defaults with a file-named warning, preserving explicit frame overrides. Readable groups omitted from `/OCGs` are added with a distinct file-named warning, preserving their default ON/OFF states; concurrent recovery warnings are combined. Malformed ON data is recoverable only when a known ON base and empty OFF list prove it cannot hide artwork; missing display names are generated without changing known visibility when no override needs name matching. Contradictory states, unresolved references and ambiguous name overrides remain errors. PDF/A-2b command exports retain the existing 300 ppi raster path for explicit overrides; PDF/A-2 permits optional content, but this change does not extend archival validation. IDML GraphicLayer visibility import remains unsupported.
+ - Placed-PDF export preparation is cached per asset and hidden-name set; repeated placements retain recovery warnings (identical warnings are deduplicated). When all groups are visible and named, the original source bytes are embedded without an incremental layer update, including sources whose broken cross-reference tables the reader repairs. Plain, PDF/X-4, booklet and book-merge output register those unmarked groups as visible. Hidden groups or generated names still require a usable cross-reference table; damage errors identify the placed file, and export retains the first placement error rather than replacing it with a later failure.
- Effects: Inner Glow (edge or centre), Bevel and Emboss (inner bevel lit from the light angle), Satin (`object.innerGlow`, `object.bevel`, `object.satin`); PDF export now keeps soft effects: objects with shadows, glows, feathers, bevels or satin go out as 300 ppi transparent images of their appearance (threaded text frames excepted).
- Directional Feather (`object.directionalFeather {widths: [top, left, bottom, right]}`): each side fades over its own width.
-- View ▸ Flattener Preview (`view.flattenerPreview`): objects involving transparency highlighted in red; knockout groups export as images (PDF output has no knockout groups).
+- View ▸ Flattener Preview (`view.flattenerPreview`): objects involving transparency highlighted in red; PDF export writes Knockout Group as a knockout transparency group (`/K true`) and Isolate Blending as `/I true`.
- Live captions (`object.caption {live: true}`, Object ▸ Captions ▸ Generate Live Caption): the caption text is re-filled from the source object's metadata after every edit (same undo step).
- - Style Export Tagging (`style.exportTag`, Paragraph Style Options ▸ Export Tagging): paragraph and character styles choose their HTML element and class in EPUB/HTML.
+ - Style Export Tagging (`style.exportTag`, Paragraph Style Options ▸ Export Tagging): paragraph and character styles choose their HTML element and class in EPUB/HTML. Its Split Document (EPUB only) flag marks the styles that start a new EPUB content file when the export splits on export tags.
+ - EPUB Export Options › Split Document (`document.epubSplit`, File › Export EPUB… dialog; `file.exportEpub {split}` for one export): off (one content file, the default), before each paragraph of a single paragraph style, or before each paragraph whose style has Split Document on in its Export Tagging. Navigation and note links point across the files. The setting is stored with the document, follows a renamed style, and round-trips through IDML (`EPubExportPreference`); Load Styles carries the per-style flag.
- Tagged Text: export (`file.exportText {format: "tagged"}`) and place (detected by its header; ASCII, UTF-8 or UTF-16) with paragraph and character styles, font, typeface and size, and `<0x…>` characters.
- Tagged PDF: one structure element per paragraph (H1–H6 and BlockQuote from Export Tagging, else P) in reading order, frame fills, strokes, rules and tables as artifacts, figures with alt text.
- EPUB: cover image from the first page (`file.exportEpub {cover}`), and Fixed Layout export (`file.exportFixedEpub`, File ▸ Export EPUB (Fixed Layout)…): pre-paginated pages as 144 ppi images with their text kept for search and read-aloud.
diff --cc xtask/src/pdf_deps.rs
index 67119b9af,e7caa5d53..e7d21434b
--- a/xtask/src/pdf_deps.rs
+++ b/xtask/src/pdf_deps.rs
@@@ -4,8 -4,7 +4,8 @@@ use std::process::Command
use serde_json::Value;
- const REPO: &str = "https://github.com/aiongg/craft-libs";
- const REV: &str = "8fbfea8840f0a0f5a22df18901e9db324894b2ce";
-const REV: &str = "a0916808f7d78bed8c7b90cdf937176015454a7f";
++const REPO: &str = "https://github.com/storytold/craft-libs";
++const REV: &str = "e3b9e239c52c14677be462e94d8920ea243de4f3";
const PACKAGES: &[(&str, &str)] = &[
("craft-pdf", "0.1.0"),
("krilla", "0.8.2"),