mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 18:23:52 -06:00
Compare commits
63
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8d80dea14 | ||
|
|
e9b36f2f0a | ||
|
|
eccff7a177 | ||
|
|
5e36a3552e | ||
|
|
d83ac52f0f | ||
|
|
f15db38adb | ||
|
|
aa406ac091 | ||
|
|
19fa1dd94b | ||
|
|
d1b327e98e | ||
|
|
d159b890d7 | ||
|
|
dfe012713a | ||
|
|
e2ca2c41b9 | ||
|
|
e419262c4c | ||
|
|
9a8e8227ff | ||
|
|
4aec38a2bc | ||
|
|
49447f46a7 | ||
|
|
c8dd6695a7 | ||
|
|
2ba369f5d8 | ||
|
|
e0f7fc8c38 | ||
|
|
40ce901c2c | ||
|
|
71fa4b6ccd | ||
|
|
fc6a3c4dbd | ||
|
|
ff812840c0 | ||
|
|
f5f106d694 | ||
|
|
6a99c025e9 | ||
|
|
e4e6f4da3b | ||
|
|
8102964f6b | ||
|
|
987a979121 | ||
|
|
ea85b0412a | ||
|
|
a4d458febe | ||
|
|
52ceb3974b | ||
|
|
324a15bc50 | ||
|
|
e6daa65687 | ||
|
|
103dc9b05c | ||
|
|
24fadbfc0e | ||
|
|
2f894ba110 | ||
|
|
b5dfac1366 | ||
|
|
53044b2ceb | ||
|
|
379391329b | ||
|
|
8d51427d1e | ||
|
|
688fbc5896 | ||
|
|
e4b1a609f2 | ||
|
|
0aabe94d68 | ||
|
|
2ca092c263 | ||
|
|
deb6e1707b | ||
|
|
037747739f | ||
|
|
55aec60818 | ||
|
|
53f09a0298 | ||
|
|
0fabcf1da7 | ||
|
|
a55b73c71f | ||
|
|
9fb1c5f974 | ||
|
|
096b70421e | ||
|
|
c6e21c4fb5 | ||
|
|
8c85789cb1 | ||
|
|
0a07e9eae1 | ||
|
|
ba63277c80 | ||
|
|
2dbcbc0c8a | ||
|
|
e39e693dab | ||
|
|
370b38e69a | ||
|
|
1a16bf975c | ||
|
|
372c0e6c44 | ||
|
|
3a1a74d2aa | ||
|
|
64d3127fe8 |
Generated
+328
-5
@@ -129,6 +129,24 @@ dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
|
||||
dependencies = [
|
||||
"as-slice",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aligned-vec"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"
|
||||
dependencies = [
|
||||
"equator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
@@ -227,6 +245,17 @@ dependencies = [
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arg_enum_proc_macro"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.9"
|
||||
@@ -245,6 +274,15 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "as-slice"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ash"
|
||||
version = "0.38.0+1.3.281"
|
||||
@@ -434,6 +472,40 @@ version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
||||
|
||||
[[package]]
|
||||
name = "av-scenechange"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"
|
||||
dependencies = [
|
||||
"aligned",
|
||||
"anyhow",
|
||||
"arg_enum_proc_macro",
|
||||
"arrayvec",
|
||||
"log",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"pastey",
|
||||
"rayon",
|
||||
"thiserror 2.0.21",
|
||||
"v_frame",
|
||||
"y4m",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "av1-grain"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arrayvec",
|
||||
"log",
|
||||
"nom",
|
||||
"num-rational",
|
||||
"v_frame",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
@@ -473,6 +545,15 @@ version = "2.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "4.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"
|
||||
dependencies = [
|
||||
"no_std_io2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
@@ -513,6 +594,12 @@ dependencies = [
|
||||
"piper",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "built"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.3"
|
||||
@@ -847,7 +934,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-audio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890"
|
||||
dependencies = [
|
||||
"craft-media",
|
||||
"thiserror 2.0.21",
|
||||
@@ -933,7 +1020,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-media"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1038,9 +1125,10 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-video"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=63196e66f3033a6623eb629af95a104d26986725#63196e66f3033a6623eb629af95a104d26986725"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890"
|
||||
dependencies = [
|
||||
"craft-media",
|
||||
"rav1e",
|
||||
"rayon",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1358,6 +1446,7 @@ dependencies = [
|
||||
"deckcraft-engine",
|
||||
"deckcraft-geom",
|
||||
"deckcraft-model",
|
||||
"deckcraft-text",
|
||||
"image",
|
||||
"log",
|
||||
"quick-xml 0.41.0",
|
||||
@@ -1603,7 +1692,7 @@ dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"emath",
|
||||
"epaint",
|
||||
"itertools",
|
||||
"itertools 0.15.0",
|
||||
"log",
|
||||
"nohash-hasher",
|
||||
"profiling",
|
||||
@@ -1665,7 +1754,7 @@ dependencies = [
|
||||
"ahash",
|
||||
"egui",
|
||||
"enum-map",
|
||||
"itertools",
|
||||
"itertools 0.15.0",
|
||||
"log",
|
||||
"profiling",
|
||||
]
|
||||
@@ -1809,6 +1898,26 @@ name = "epaint_default_fonts"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a#6d518fc799681571963842f95b55a6b68431b15a"
|
||||
|
||||
[[package]]
|
||||
name = "equator"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"
|
||||
dependencies = [
|
||||
"equator-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equator-macro"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
@@ -2719,6 +2828,17 @@ dependencies = [
|
||||
"hashbrown 0.17.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interpolate_name"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-docker"
|
||||
version = "0.2.0"
|
||||
@@ -2738,6 +2858,15 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.15.0"
|
||||
@@ -2928,6 +3057,16 @@ version = "0.2.190"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.9"
|
||||
@@ -3013,6 +3152,16 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "maybe-rayon"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
@@ -3151,6 +3300,12 @@ dependencies = [
|
||||
"jni-sys 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "new_debug_unreachable"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.31.3"
|
||||
@@ -3163,6 +3318,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "no_std_io2"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nohash-hasher"
|
||||
version = "0.2.0"
|
||||
@@ -3178,6 +3342,12 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "noop_proc_macro"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.3"
|
||||
@@ -3187,6 +3357,16 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.2.2"
|
||||
@@ -3204,6 +3384,26 @@ dependencies = [
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
@@ -3689,6 +3889,18 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "pastey"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
||||
|
||||
[[package]]
|
||||
name = "pdf-writer"
|
||||
version = "0.15.0"
|
||||
@@ -3926,6 +4138,15 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "presser"
|
||||
version = "0.3.1"
|
||||
@@ -3955,6 +4176,19 @@ name = "profiling"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
|
||||
dependencies = [
|
||||
"profiling-procmacros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling-procmacros"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pxfm"
|
||||
@@ -4007,12 +4241,75 @@ version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08"
|
||||
|
||||
[[package]]
|
||||
name = "rav1e"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
|
||||
dependencies = [
|
||||
"aligned-vec",
|
||||
"arbitrary",
|
||||
"arg_enum_proc_macro",
|
||||
"arrayvec",
|
||||
"av-scenechange",
|
||||
"av1-grain",
|
||||
"bitstream-io",
|
||||
"built",
|
||||
"cfg-if",
|
||||
"interpolate_name",
|
||||
"itertools 0.14.0",
|
||||
"libc",
|
||||
"libfuzzer-sys",
|
||||
"log",
|
||||
"maybe-rayon",
|
||||
"new_debug_unreachable",
|
||||
"noop_proc_macro",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"profiling",
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
"simd_helpers",
|
||||
"thiserror 2.0.21",
|
||||
"v_frame",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.2"
|
||||
@@ -4500,6 +4797,15 @@ dependencies = [
|
||||
"simdutf8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd_helpers"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
|
||||
dependencies = [
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simdutf8"
|
||||
version = "0.1.5"
|
||||
@@ -5350,6 +5656,17 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "v_frame"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
|
||||
dependencies = [
|
||||
"aligned-vec",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vello_common"
|
||||
version = "0.2.0"
|
||||
@@ -6417,6 +6734,12 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "y4m"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.8.3"
|
||||
|
||||
+3
-3
@@ -64,10 +64,10 @@ craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "254e9a409
|
||||
# The .deckcraft package layer (identity, manifest, member names, bounded reads); crates/format maps the presentation onto it.
|
||||
craft-deckcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "254e9a409b410dc93c0e06ff66cd1e767893ac32", version = "=0.1.0" }
|
||||
craft-rtf = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0" }
|
||||
craft-media = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false }
|
||||
craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false, features = ["opus-decode"] }
|
||||
craft-media = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false }
|
||||
craft-audio = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false, features = ["opus-decode"] }
|
||||
# H.264, HEVC, VP9 and AV1 decoders.
|
||||
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false, features = ["h264-decode", "hevc-decode", "vp9-decode", "av1-decode", "threads"] }
|
||||
craft-video = { git = "https://github.com/storytold/craft-libs", rev = "010702ee9b030844c852939095b1da0d0656a890", version = "=0.1.0", default-features = false, features = ["h264-decode", "hevc-decode", "vp9-decode", "av1-decode", "threads"] }
|
||||
# WMF, EMF and EMF+ reader.
|
||||
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "63196e66f3033a6623eb629af95a104d26986725", version = "=0.1.0", default-features = false, features = ["write", "write-simple-text"] }
|
||||
|
||||
+9
-1
@@ -2,7 +2,9 @@
|
||||
|
||||
**Stage: alpha** · next: beta, ~20 points and ~120–210 h away
|
||||
|
||||
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-14 · **Change:** trivial (a slide the show advances to again plays its animations again, #2090; slide-list entries with missing relationships are reported as lost slides and open as repaired copies; the Opus decoder and the Ogg, MP4 and Matroska demuxers come from craft-libs; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-16 · **Change:** trivial (progress log: every slide as PNG or JPEG from File › Export › Change File Type and Save As, #2019; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-14 · **Change:** minor (a slide the show advances to again plays its animations again, #2090; slide-list entries with missing relationships are reported as lost slides and open as repaired copies; the Opus decoder and the Ogg, MP4 and Matroska demuxers come from craft-libs; empty notes slides are kept through PPTX and native saves, #2025; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-04 · **Last updated:** 2026-11-07 · **Change:** trivial (progress log: text in a group whose child coordinates scale its shapes is placed for export where the slide draws it; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-03 · **Change:** trivial (progress log: web `?host=parent` bridge opens and saves through a same-origin framing page; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-03 · **Change:** trivial (community PR wave 10: PPTX and native saves keep table cell centred anchoring, text overflow, compatible line spacing, normalised character height, Thai distributed alignment, RTL table direction, alternate run language and reflection transforms; imported effects placed by parent time-node delays; Reuse Slides fits the destination size and brings custom table styles; deleted slides leave custom shows; merged shapes drop their animations; Compress Pictures measures grouped pictures at displayed size; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
@@ -154,9 +156,12 @@ app's JSON control channel (`deckcraft --control PORT`).
|
||||
|
||||
| Date | What landed |
|
||||
|---|---|
|
||||
| 2026-11-16 | Export: every slide as its own PNG or JPEG picture from File › Export › Change File Type and File › Save As; the Export… dialog adds JPEG images (all slides) (#2019) |
|
||||
| 2026-11-14 | Slide show: a slide the show advances to again (click, →, Space, automatic advance or a loop) starts over, so its animations play again, as in PowerPoint. Back and links still show it as it was left (#2090) |
|
||||
| 2026-11-11 | PPTX: a slide whose notes slide has empty text retains its notesSlide part and relationship on save and reopen (#2025); empty notes slides survive native round trips |
|
||||
| 2026-11-11 | Media: the Opus decoder and the Ogg, MP4/MOV and Matroska demuxers are craft-audio and craft-media from craft-libs; DeckCraft's own copies and re-export crates are removed |
|
||||
| 2026-11-07 | PPTX slide-list entries with missing relationships are reported in lostSlides instead of silently omitted. The engine opens the partial deck as a repaired copy with no original save path. Slide lists over 10,000 entries are explicitly refused before a partial load; exactly 10,000 remain supported. Synthetic 13-slide regression; does not establish the cause of #1910's field report. |
|
||||
| 2026-11-07 | Text inside a group whose child coordinates scale its shapes is laid out for export as the slide draws it, at the shape's size in points, so the PDF text layer and the boxes of its text hyperlinks lie on the drawn text. SmartArt groups, whose child space equals their frame, are unchanged |
|
||||
| 2026-11-04 | Ogg Opus recovery keeps trailing packets without granules in the total duration, matching their recovered positions; valid end trimming stays covered |
|
||||
| 2026-11-03 | Web: the `?host=parent` bridge (as in GridCraft, WordCraft and PdfCraft) lets a same-origin page that frames DeckCraft send a presentation and store its saves; Save writes an opened .pptx back as .pptx under its own name, as on the desktop |
|
||||
| 2026-11-02 | Slide show on Linux and the BSDs: Presenter View stays off when winit lists exactly one display, as in PowerPoint; if it lists none, the setting is kept. On one display the presenter window covered the show, and the hidden window stalled every frame: slide changes took up to ~1.7 s under Hyprland (#1156) |
|
||||
@@ -343,8 +348,11 @@ app's JSON control channel (`deckcraft --control PORT`).
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-16 | trivial | Progress log: export all slides as PNG or JPEG from the File tab (#2019); scores unchanged |
|
||||
| 2026-11-14 | trivial | Progress log: a slide the show advances to again plays its animations again (#2090); parity scores unchanged |
|
||||
| 2026-11-11 | minor | Progress log: empty notes slides preserved on PPTX/native save (#2025); parity scores unchanged |
|
||||
| 2026-11-11 | trivial | Opus and container code moved to craft-libs crates; parity scores unchanged |
|
||||
| 2026-11-07 | trivial | Progress log: text in scaled groups is placed for export where it is drawn; parity scores unchanged |
|
||||
| 2026-11-04 | trivial | Ogg Opus recovery duration includes its recovered tail; parity scores unchanged |
|
||||
| 2026-11-02 | trivial | Progress log: run alternate-language metadata round-trips through native and PPTX formats; product parity scores unchanged |
|
||||
| 2026-11-03 | trivial | Reuse Slides brings referenced custom table styles along; scores unchanged |
|
||||
|
||||
@@ -176,7 +176,10 @@ pub(super) fn header_footer(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}
|
||||
(Some(pos), true) if k == PhType::Date && (date_given || format_given) => {
|
||||
if let Some(sh) = sl.shapes.get_mut(pos) {
|
||||
set_date(sh, &hf.date_text, &hf.date_format);
|
||||
// The deck's format always travels; whether the caller asked for it
|
||||
// is what decides if it may rewrite a field the slide already has
|
||||
// (see `set_date`).
|
||||
set_date(sh, &hf.date_text, &hf.date_format, format_given);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
@@ -200,8 +203,19 @@ fn date_now(format: &str) -> String {
|
||||
}
|
||||
|
||||
/// Point a slide's date placeholder at a fixed date (its own plain text) or, for an empty
|
||||
/// `fixed`, at an automatic date field (one it already has keeps its format).
|
||||
fn set_date(sh: &mut Shape, fixed: &str, format: &str) {
|
||||
/// `fixed`, at an automatic date field.
|
||||
///
|
||||
/// `format_given` is whether the caller named a format. The dialog always sends `dateText`, so an
|
||||
/// Apply with no format selection reached here carrying the deck's global format and rewrote a
|
||||
/// slide's own `datetime11` field to it -- a format the caller never mentioned. A field the slide
|
||||
/// already has therefore keeps its own format unless one was asked for.
|
||||
///
|
||||
/// That holds only where there *is* a field to keep. A placeholder showing a fixed date has no
|
||||
/// date field and no format of its own, so clearing `dateText` without naming a format used to
|
||||
/// build a `datetime1`: a slide that went from `datetime11` to fixed text and back came away on
|
||||
/// the short date. With nothing to preserve, the deck's remembered format is the right one to
|
||||
/// take (noted in review).
|
||||
fn set_date(sh: &mut Shape, fixed: &str, format: &str, format_given: bool) {
|
||||
let runs = || sh.text.iter().flat_map(|t| &t.paragraphs).flat_map(|p| &p.runs);
|
||||
let field_now = runs().find_map(|r| match &r.kind {
|
||||
RunKind::Field { field } if deckcraft_text::datetime::is_date_field(field) => Some(field.clone()),
|
||||
@@ -209,6 +223,7 @@ fn set_date(sh: &mut Shape, fixed: &str, format: &str) {
|
||||
});
|
||||
let has_field = field_now.is_some();
|
||||
let props = runs().next().map(|r| r.props.clone()).unwrap_or_default();
|
||||
let format = if format_given || !has_field { format } else { "" };
|
||||
let want = date_kind(format);
|
||||
let (text, kind) = match fixed {
|
||||
// Automatic: keep the field, but follow a format that has changed.
|
||||
@@ -298,6 +313,55 @@ mod header_footer_date_tests {
|
||||
got[0].0.clone()
|
||||
}
|
||||
|
||||
/// The dialog always sends `dateText`, so an Apply with no format selection reached
|
||||
/// `set_date` with the deck's global format and rewrote a slide's own date field to it. The
|
||||
/// format the caller did not mention is not a format the caller asked for (noted in review).
|
||||
#[test]
|
||||
fn an_apply_with_no_format_leaves_each_slides_own_format_alone() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({})).unwrap();
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime11", "all": true})).unwrap();
|
||||
let kinds = |s: &Session| dates(s).into_iter().map(|(_, k)| k).collect::<Vec<_>>();
|
||||
assert_eq!(kinds(&s), vec![Some("datetime11".to_string()); 2], "both slides start on the time format");
|
||||
|
||||
// One slide alone takes a different format, which also becomes the deck's global one.
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime5", "all": false})).unwrap();
|
||||
assert_eq!(kinds(&s), vec![Some("datetime11".to_string()), Some("datetime5".to_string())]);
|
||||
assert_eq!(s.doc().unwrap().doc.header_footer.date_format, "datetime5");
|
||||
|
||||
// Apply with no `dateFormat`: the first slide keeps datetime11 rather than being rewritten
|
||||
// to the global datetime5.
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateText": "", "all": true})).unwrap();
|
||||
assert_eq!(kinds(&s), vec![Some("datetime11".to_string()), Some("datetime5".to_string())], "neither slide was rewritten");
|
||||
|
||||
// And a format that *is* given still reaches every slide, so the guard is not a block.
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime2", "all": true})).unwrap();
|
||||
assert_eq!(kinds(&s), vec![Some("datetime2".to_string()); 2], "a format the caller asked for still applies");
|
||||
}
|
||||
|
||||
/// A fixed date is plain text, so the placeholder has no date field and no format of its
|
||||
/// own. Clearing `dateText` without naming a format therefore has nothing to preserve, and
|
||||
/// built a `datetime1`: a slide that went from `datetime11` to fixed text and back came away
|
||||
/// on the short date (noted in review).
|
||||
#[test]
|
||||
fn a_fixed_date_turned_automatic_again_comes_back_on_the_remembered_format() {
|
||||
let mut s = Session::with_new();
|
||||
run_automatic(&mut s, json!({"date": true, "dateFormat": "datetime11", "all": true}), "datetime11");
|
||||
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateText": "4 July 1776", "all": true})).unwrap();
|
||||
assert_eq!(dates(&s), vec![("4 July 1776".to_string(), None)], "fixed: plain text, no field");
|
||||
|
||||
// No `dateFormat` in this call, which is what the dialog sends on an Apply.
|
||||
run_automatic(&mut s, json!({"date": true, "dateText": "", "all": true}), "datetime11");
|
||||
|
||||
// And the guard this must not undo: where there *is* a field, an Apply naming no format
|
||||
// still leaves the slide's own format alone, although the deck's format now reaches
|
||||
// `set_date` either way.
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateFormat": "datetime5", "all": false})).unwrap();
|
||||
s.execute("design.headerFooter", &json!({"date": true, "dateText": "", "all": true})).unwrap();
|
||||
assert_eq!(dates(&s)[0].1.as_deref(), Some("datetime5"), "the slide's own format survives");
|
||||
}
|
||||
|
||||
/// Header & Footer's automatic date takes the format it is given. `HeaderFooter::date_format`
|
||||
/// existed for this and was never read: the placeholder was always `datetime1`, and a
|
||||
/// `dateFormat` parameter was accepted and silently dropped.
|
||||
|
||||
@@ -62,7 +62,15 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
),
|
||||
cmd!("format.superscript", "Superscript", ["Home", "Font"], Some("Cmd+Shift+="), "{on?: bool}", has_text_or_shapes, superscript),
|
||||
cmd!("format.subscript", "Subscript", ["Home", "Font"], Some("Cmd+="), "{on?: bool}", has_text_or_shapes, subscript),
|
||||
cmd!("format.font", "Font", ["Home", "Font"], None, "{family}", has_text_or_shapes, font),
|
||||
cmd!(
|
||||
"format.font",
|
||||
"Font",
|
||||
["Home", "Font"],
|
||||
None,
|
||||
"{family, eastAsia?: family, complexScript?: family} — `family` is the Latin typeface (`a:latin`); the other two set the East Asian (`a:ea`) and complex-script (`a:cs`) typefaces, which are left alone when not given",
|
||||
has_text_or_shapes,
|
||||
font
|
||||
),
|
||||
cmd!("format.size", "Font Size", ["Home", "Font"], None, "{size: pt}", has_text_or_shapes, size),
|
||||
cmd!("format.grow", "Increase Font Size", ["Home", "Font"], Some("Cmd+Shift+."), "{}", has_text_or_shapes, grow),
|
||||
cmd!("format.shrink", "Decrease Font Size", ["Home", "Font"], Some("Cmd+Shift+,"), "{}", has_text_or_shapes, shrink),
|
||||
|
||||
@@ -45,9 +45,41 @@ pub(super) fn subscript(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
format_run(s, &move |r| r.baseline = Some(if v { -0.25 } else { 0.0 }))
|
||||
}
|
||||
|
||||
/// A typeface name from `key`: trimmed, and the length `format.fontDialog` allows.
|
||||
///
|
||||
/// Absent, as `opt_usize_param` and `id_param` read an absent key, so a call that leaves a script
|
||||
/// out keeps that typeface. Present but not a string is refused: `str_param` answers `None` to
|
||||
/// both, so `{"family": "Lato", "eastAsia": 42}` used to set the Latin typeface, leave the East
|
||||
/// Asian one alone and report success -- the one thing the caller asked for silently not done.
|
||||
fn typeface_param(p: &Value, key: &str) -> Result<Option<String>> {
|
||||
let v = match p.get(key) {
|
||||
None | Some(Value::Null) => return Ok(None),
|
||||
Some(v) => v.as_str().ok_or_else(|| bad("format.font", format!("`{key}` is not a typeface name: {v}")))?,
|
||||
};
|
||||
let t = v.trim();
|
||||
if t.is_empty() || t.chars().count() > 200 {
|
||||
return Err(bad("format.font", format!("`{key}` must be 1-200 characters")));
|
||||
}
|
||||
Ok(Some(t.to_string()))
|
||||
}
|
||||
|
||||
pub(super) fn font(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let f = str_param(p, "family").ok_or_else(|| bad("format.font", "missing `family`"))?.to_string();
|
||||
format_run(s, &move |r| r.font = Some(f.clone()))
|
||||
let f = typeface_param(p, "family")?.ok_or_else(|| bad("format.font", "missing `family`"))?;
|
||||
// A run carries a typeface per script (ECMA-376 §21.1.2.3): `a:latin`, `a:ea` and `a:cs`.
|
||||
// Setting only the Latin one leaves a CJK run drawing -- and saving -- in whatever `a:ea`
|
||||
// named before, so the two are settable (#786). Left out, they keep their value, which is
|
||||
// what `format.font` has always done.
|
||||
let ea = typeface_param(p, "eastAsia")?;
|
||||
let cs = typeface_param(p, "complexScript")?;
|
||||
format_run(s, &move |r| {
|
||||
r.font = Some(f.clone());
|
||||
if let Some(v) = &ea {
|
||||
r.font_ea = Some(v.clone());
|
||||
}
|
||||
if let Some(v) = &cs {
|
||||
r.font_cs = Some(v.clone());
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn size(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
|
||||
@@ -602,11 +602,15 @@ fn notes(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let text = str_param(p, "text").unwrap_or("").to_string();
|
||||
s.edit(|doc, _| {
|
||||
if let Some(sl) = doc.slides.get_mut(i) {
|
||||
let notes = &mut Arc::make_mut(sl).notes;
|
||||
let sl = Arc::make_mut(sl);
|
||||
let notes = &mut sl.notes;
|
||||
match body {
|
||||
Some(b) => *notes = b,
|
||||
None => deckcraft_model::edit::replace_text(notes, &text),
|
||||
}
|
||||
if !notes.is_empty() {
|
||||
sl.has_notes_slide = true;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
@@ -186,3 +186,136 @@ pub(crate) fn edit_text<T>(s: &mut Session, f: impl FnOnce(&mut TextBody, &mut T
|
||||
}
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod font_script_tests {
|
||||
use super::*;
|
||||
|
||||
/// Every run's (latin, east asian, complex script) typefaces in the deck.
|
||||
fn typefaces(s: &mut Session) -> Vec<(Option<String>, Option<String>, Option<String>)> {
|
||||
s.doc()
|
||||
.unwrap()
|
||||
.doc
|
||||
.slides
|
||||
.iter()
|
||||
.flat_map(|sl| sl.shapes.iter())
|
||||
.filter_map(|sh| sh.text.as_ref())
|
||||
.flat_map(|t| t.paragraphs.iter())
|
||||
.flat_map(|para| para.runs.iter())
|
||||
.map(|r| (r.props.font.clone(), r.props.font_ea.clone(), r.props.font_cs.clone()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_font_sets_the_east_asian_and_complex_script_typefaces() {
|
||||
// A run carries a typeface per script; setting only the Latin one leaves a CJK run
|
||||
// drawing, and saving, in whatever `a:ea` named before (#786).
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.textBox", &json!({"rect": [10, 10, 300, 50], "text": "Hello"})).unwrap();
|
||||
s.execute("text.exit", &json!({})).unwrap();
|
||||
|
||||
// All three at once.
|
||||
s.execute("format.font", &json!({"family": "Lato", "eastAsia": "Noto Sans CJK SC", "complexScript": "Noto Sans Arabic"})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]);
|
||||
|
||||
// The Latin-only call keeps its old meaning: the other two are left alone, which is
|
||||
// what makes the new parameters additive.
|
||||
s.execute("format.font", &json!({"family": "Comic Neue"})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Comic Neue".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]);
|
||||
|
||||
// And they reach the file: the issue is that a saved deck kept asking for the old
|
||||
// East Asian font.
|
||||
let bytes = crate::cmd::file::save_bytes(&s.doc().unwrap().doc, "pptx").unwrap();
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap();
|
||||
// The text box is on whichever slide was current, so look across all of them.
|
||||
let mut xml = String::new();
|
||||
for i in 0..zip.len() {
|
||||
let mut f = zip.by_index(i).unwrap();
|
||||
if f.name().starts_with("ppt/slides/slide") && f.name().ends_with(".xml") {
|
||||
std::io::Read::read_to_string(&mut f, &mut xml).unwrap();
|
||||
}
|
||||
}
|
||||
assert!(xml.contains(r#"<a:ea typeface="Noto Sans CJK SC"/>"#), "no a:ea in the saved slides");
|
||||
assert!(xml.contains(r#"<a:cs typeface="Noto Sans Arabic"/>"#), "no a:cs in the saved slides");
|
||||
assert!(xml.contains(r#"<a:latin typeface="Comic Neue"/>"#), "no a:latin in the saved slides");
|
||||
|
||||
// Read back, they are still there.
|
||||
s.execute("file.openBytes", &json!({"name": "f.pptx", "data": crate::cmd::base64_encode(&bytes)})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Comic Neue".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_font_rejects_an_unusable_typeface_name() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.textBox", &json!({"rect": [10, 10, 300, 50], "text": "Hello"})).unwrap();
|
||||
s.execute("text.exit", &json!({})).unwrap();
|
||||
for p in [json!({"family": " "}), json!({"family": "Lato", "eastAsia": ""}), json!({"family": "Lato", "complexScript": "x".repeat(201)})] {
|
||||
assert!(s.execute("format.font", &p).is_err(), "{p} should be rejected");
|
||||
}
|
||||
|
||||
// A script key that is present but not a string is refused, not read as absent. It used
|
||||
// to set `family` and report success with the script typeface untouched, so the one thing
|
||||
// the call asked for was the one thing that did not happen (noted in review).
|
||||
for p in [
|
||||
json!({"family": "Lato", "eastAsia": 42}),
|
||||
json!({"family": "Lato", "complexScript": true}),
|
||||
json!({"family": "Lato", "eastAsia": ["Noto Sans CJK SC"]}),
|
||||
json!({"family": "Lato", "complexScript": {"name": "Noto Sans Arabic"}}),
|
||||
json!({"family": 42}),
|
||||
] {
|
||||
let e = s.execute("format.font", &p).expect_err(&format!("{p} should be rejected"));
|
||||
assert!(format!("{e}").contains("is not a typeface name"), "{p}: {e}");
|
||||
}
|
||||
// Nothing above changed a run: the first call in this test left `family` unset, and a
|
||||
// refused call must not have set it on the way to the error.
|
||||
assert_eq!(typefaces(&mut s), vec![(None, None, None)]);
|
||||
|
||||
// An explicit `null` reads as absent, as it does for an index or a shape id, so the
|
||||
// script keeps whatever typeface it had.
|
||||
s.execute("format.font", &json!({"family": "Lato", "eastAsia": "Noto Sans CJK SC"})).unwrap();
|
||||
s.execute("format.font", &json!({"family": "Lato", "eastAsia": null})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]);
|
||||
|
||||
// A name with spaces around it is kept, trimmed.
|
||||
s.execute("format.font", &json!({"family": " Lato ", "eastAsia": " Noto Sans CJK SC "})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]);
|
||||
}
|
||||
|
||||
/// Each script's typeface is set on its own, and a run whose text is entirely CJK takes its
|
||||
/// East Asian one: that is the run #786 is about, where `a:latin` alone changes nothing that
|
||||
/// is drawn (noted in review).
|
||||
#[test]
|
||||
fn a_cjk_run_takes_the_east_asian_typeface_and_each_script_is_set_on_its_own() {
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
s.execute("insert.textBox", &json!({"rect": [10, 10, 300, 50], "text": "你好世界"})).unwrap();
|
||||
s.execute("text.exit", &json!({})).unwrap();
|
||||
|
||||
// `eastAsia` alone (with the required `family`): the complex-script typeface is untouched.
|
||||
s.execute("format.font", &json!({"family": "Lato", "eastAsia": "Noto Sans CJK SC"})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), None)]);
|
||||
|
||||
// `complexScript` alone: the East Asian typeface just set is kept, not cleared.
|
||||
s.execute("format.font", &json!({"family": "Lato", "complexScript": "Noto Sans Arabic"})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Lato".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]);
|
||||
|
||||
// A Latin-only call on the CJK run changes `a:latin` and nothing a CJK glyph is drawn in.
|
||||
s.execute("format.font", &json!({"family": "Comic Neue"})).unwrap();
|
||||
assert_eq!(typefaces(&mut s), vec![(Some("Comic Neue".into()), Some("Noto Sans CJK SC".into()), Some("Noto Sans Arabic".into()))]);
|
||||
|
||||
// The saved run carries its text and the East Asian typeface together.
|
||||
let bytes = crate::cmd::file::save_bytes(&s.doc().unwrap().doc, "pptx").unwrap();
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap();
|
||||
let mut xml = String::new();
|
||||
for i in 0..zip.len() {
|
||||
let mut f = zip.by_index(i).unwrap();
|
||||
if f.name().starts_with("ppt/slides/slide") && f.name().ends_with(".xml") {
|
||||
std::io::Read::read_to_string(&mut f, &mut xml).unwrap();
|
||||
}
|
||||
}
|
||||
let run = xml.find("你好世界").and_then(|at| xml[..at].rfind("<a:r>").map(|start| &xml[start..at])).unwrap_or_default();
|
||||
assert!(run.contains(r#"<a:ea typeface="Noto Sans CJK SC"/>"#), "the CJK run has no a:ea: {run}");
|
||||
}
|
||||
}
|
||||
|
||||
+138
-15
@@ -538,7 +538,57 @@ fn valid_lang(lang: &str) -> bool {
|
||||
(1..=16).contains(&lang.len()) && lang.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_')
|
||||
}
|
||||
|
||||
/// The `.aff`/`.dic` pair for `lang` in `dirs`: the exact locale first, then any of its language.
|
||||
/// The script a language tag or a dictionary's name states, lowercased: a script subtag
|
||||
/// (`sr-Latn`, `sr_Latn_RS`) or a `@latin`/`@cyrillic` modifier (Fedora's `sr_RS@latin`). Only
|
||||
/// the scripts a dictionary is chosen by are read (Latin and Cyrillic), so another part of a name
|
||||
/// (a variant such as `de-1996`, a suffix such as `en_US-wiki`) is never taken for one.
|
||||
fn named_script(name: &str) -> Option<String> {
|
||||
name.split(['-', '_', '@']).skip(1).find_map(|p| match p.to_ascii_lowercase().as_str() {
|
||||
"latn" | "latin" => Some("latn".to_string()),
|
||||
"cyrl" | "cyrillic" => Some("cyrl".to_string()),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
/// The script of a language written in more than one, when a tag or a dictionary's name doesn't
|
||||
/// state it: Serbian is Cyrillic (`sr-RS`, and LibreOffice's and Hunspell's `sr` dictionary), its
|
||||
/// Latin dictionary says so (`sr-Latn`, `sr_Latn_RS`, `sr_RS@latin`).
|
||||
fn default_script(base: &str) -> Option<&'static str> {
|
||||
match base {
|
||||
"sr" => Some("cyrl"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Another language code a language's dictionaries are filed under, and their script: Serbian
|
||||
/// Latin dictionaries are often Serbo-Croatian ones (Hunspell's `sh_RS`, `sh_YU`).
|
||||
fn alias(base: &str) -> Option<(&'static str, &'static str)> {
|
||||
match base {
|
||||
"sr" => Some(("sh", "latn")),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The language code a dictionary is named for (`sr_Latn_RS`, `sr-Latn` → `sr`), lowercased.
|
||||
fn stem_language(stem: &str) -> String {
|
||||
stem.split(['-', '_', '@']).next().unwrap_or("").to_ascii_lowercase()
|
||||
}
|
||||
|
||||
/// Is the dictionary named `stem` for text in the script of `lang` (language `base`)? A Cyrillic
|
||||
/// dictionary would flag every word of Latin text, and the other way round. The run's language tag
|
||||
/// decides, not the letters of the text. When either side's script is unknown, any dictionary of
|
||||
/// the language fits, as before.
|
||||
fn same_script(lang: &str, stem: &str, base: &str) -> bool {
|
||||
let default = || default_script(base).map(str::to_string);
|
||||
let aliased = alias(base).filter(|(code, _)| stem_language(stem) == *code).map(|(_, script)| script.to_string());
|
||||
match (named_script(lang).or_else(default), named_script(stem).or(aliased).or_else(default)) {
|
||||
(Some(want), Some(have)) => want == have,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
/// The `.aff`/`.dic` pair for `lang` in `dirs`: the exact locale first, then any of its language
|
||||
/// (or the language its dictionaries are also filed under, [`alias`]) in the same script.
|
||||
pub fn find_in(dirs: &[PathBuf], lang: &str) -> Option<(PathBuf, PathBuf)> {
|
||||
// A language tag names a file in the dictionary folders and nothing else: no `..`, no separators.
|
||||
if !valid_lang(lang) {
|
||||
@@ -550,23 +600,33 @@ pub fn find_in(dirs: &[PathBuf], lang: &str) -> Option<(PathBuf, PathBuf)> {
|
||||
(a.is_file() && b.is_file()).then_some((a, b))
|
||||
};
|
||||
for d in dirs {
|
||||
if let Some(p) = pair(d, &full) {
|
||||
if let Some(p) = pair(d, &full).or_else(|| pair(d, lang)) {
|
||||
return Some(p);
|
||||
}
|
||||
}
|
||||
for d in dirs {
|
||||
if let Some(p) = pair(d, &base) {
|
||||
return Some(p);
|
||||
}
|
||||
let Ok(rd) = std::fs::read_dir(d) else { continue };
|
||||
let mut stems: Vec<String> = rd
|
||||
.filter_map(|e| e.ok()?.file_name().into_string().ok())
|
||||
.filter_map(|n| n.strip_suffix(".aff").map(str::to_string))
|
||||
.filter(|n| n.to_lowercase().starts_with(&format!("{base}_")))
|
||||
.collect();
|
||||
stems.sort();
|
||||
if let Some(p) = stems.iter().find_map(|s| pair(d, s)) {
|
||||
return Some(p);
|
||||
// The language's own dictionaries first, in every folder; then those filed under its alias
|
||||
// (a Serbian Latin dictionary before a Serbo-Croatian one).
|
||||
let codes = std::iter::once(base.as_str()).chain(alias(&base).map(|(code, _)| code));
|
||||
for code in codes {
|
||||
for d in dirs {
|
||||
if same_script(lang, code, &base)
|
||||
&& let Some(p) = pair(d, code)
|
||||
{
|
||||
return Some(p);
|
||||
}
|
||||
let Ok(rd) = std::fs::read_dir(d) else { continue };
|
||||
// `sr_Latn_RS`, LibreOffice's `sr-Latn` and Fedora's `sr_RS@latin` all name a Serbian
|
||||
// dictionary.
|
||||
let mut stems: Vec<String> = rd
|
||||
.filter_map(|e| e.ok()?.file_name().into_string().ok())
|
||||
.filter_map(|n| n.strip_suffix(".aff").map(str::to_string))
|
||||
.filter(|n| stem_language(n) == code && !n.eq_ignore_ascii_case(code))
|
||||
.filter(|n| same_script(lang, n, &base))
|
||||
.collect();
|
||||
stems.sort();
|
||||
if let Some(p) = stems.iter().find_map(|s| pair(d, s)) {
|
||||
return Some(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
@@ -1078,4 +1138,67 @@ SFX D Y 1\nSFX D 0 ed/S .\n";
|
||||
assert_eq!(stem("fr-FR"), None);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// Serbian is written in two scripts, and each finds its own dictionary: LibreOffice names
|
||||
/// the Cyrillic one `sr` and the Latin one `sr-Latn`, Hunspell packages `sr_RS` and
|
||||
/// `sr_Latn_RS`, Fedora `sr_RS` and `sr_RS@latin`, and Latin ones may be Serbo-Croatian
|
||||
/// (`sh_RS`, `sh_YU`). A dictionary of the other script is never used: it would flag every word.
|
||||
#[test]
|
||||
fn serbian_finds_the_dictionary_of_its_script() {
|
||||
let dir = std::env::temp_dir().join(format!("deckcraft-dict-sr-{}", std::process::id()));
|
||||
let stem = |names: &[&str], l: &str| {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
let _ = std::fs::create_dir_all(&dir);
|
||||
for n in names {
|
||||
let _ = std::fs::write(dir.join(format!("{n}.aff")), "");
|
||||
let _ = std::fs::write(dir.join(format!("{n}.dic")), "");
|
||||
}
|
||||
find_in(std::slice::from_ref(&dir), l).and_then(|(a, _)| a.file_stem().map(|s| s.to_string_lossy().into_owned()))
|
||||
};
|
||||
let libreoffice = ["sr", "sr-Latn"];
|
||||
assert_eq!(stem(&libreoffice, "sr-Cyrl-RS").as_deref(), Some("sr"));
|
||||
assert_eq!(stem(&libreoffice, "sr-RS").as_deref(), Some("sr"));
|
||||
assert_eq!(stem(&libreoffice, "sr-Latn-RS").as_deref(), Some("sr-Latn"));
|
||||
let hunspell = ["sr_Latn_RS", "sr_RS"];
|
||||
assert_eq!(stem(&hunspell, "sr-Cyrl-RS").as_deref(), Some("sr_RS"));
|
||||
assert_eq!(stem(&hunspell, "sr-Latn-RS").as_deref(), Some("sr_Latn_RS"));
|
||||
let fedora = ["sr_RS", "sr_RS@latin"];
|
||||
assert_eq!(stem(&fedora, "sr-Cyrl-RS").as_deref(), Some("sr_RS"));
|
||||
assert_eq!(stem(&fedora, "sr-Latn-RS").as_deref(), Some("sr_RS@latin"));
|
||||
assert_eq!(stem(&["sr_RS@latin"], "sr-Cyrl-RS"), None);
|
||||
// Serbo-Croatian dictionaries are Latin: they serve Serbian Latin, never Cyrillic.
|
||||
assert_eq!(stem(&["sh_RS"], "sr-Latn-RS").as_deref(), Some("sh_RS"));
|
||||
assert_eq!(stem(&["sh_YU"], "sr-Latn-RS").as_deref(), Some("sh_YU"));
|
||||
assert_eq!(stem(&["sh"], "sr-Latn-RS").as_deref(), Some("sh"));
|
||||
assert_eq!(stem(&["sh_RS"], "sr-Cyrl-RS"), None);
|
||||
assert_eq!(stem(&["sh_RS", "sr"], "sr-RS").as_deref(), Some("sr"));
|
||||
// A Serbian Latin dictionary comes before a Serbo-Croatian one.
|
||||
assert_eq!(stem(&["sh_RS", "sr-Latn"], "sr-Latn-RS").as_deref(), Some("sr-Latn"));
|
||||
assert_eq!(stem(&["sh", "sr_RS@latin"], "sr-Latn-RS").as_deref(), Some("sr_RS@latin"));
|
||||
// Only the other script installed: no dictionary, so no marks, rather than every word.
|
||||
assert_eq!(stem(&["sr"], "sr-Latn-RS"), None);
|
||||
assert_eq!(stem(&["sr-Latn"], "sr-Cyrl-RS"), None);
|
||||
// Languages in one script are unchanged.
|
||||
assert_eq!(stem(&["de_DE"], "de-AT").as_deref(), Some("de_DE"));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// The script is read from a script subtag or a `@latin`/`@cyrillic` modifier, in tags and
|
||||
/// dictionary names alike; a variant, a region or another suffix is not a script.
|
||||
#[test]
|
||||
fn a_script_is_read_only_from_a_script_subtag() {
|
||||
let script = |n| named_script(n);
|
||||
assert_eq!(script("sr-Cyrl").as_deref(), Some("cyrl"));
|
||||
assert_eq!(script("sr-Cyrl-RS").as_deref(), Some("cyrl"));
|
||||
assert_eq!(script("sr-Latn").as_deref(), Some("latn"));
|
||||
assert_eq!(script("sr_Latn_RS").as_deref(), Some("latn"));
|
||||
assert_eq!(script("sr_RS@latin").as_deref(), Some("latn"));
|
||||
assert_eq!(script("sr_RS@cyrillic").as_deref(), Some("cyrl"));
|
||||
for none in ["sr", "sr-RS", "sr_RS", "de-1996", "de_DE", "en_US-wiki", "en-GB-oxendict", "zh-Hans"] {
|
||||
assert_eq!(script(none), None, "{none}");
|
||||
}
|
||||
// Plain Serbian, with no script, is Cyrillic.
|
||||
assert!(same_script("sr", "sr", "sr") && same_script("sr-RS", "sr_Cyrl_RS", "sr"));
|
||||
assert!(!same_script("sr", "sr-Latn", "sr"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ pub(crate) fn probe_fits(b: &[u8]) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
use craft_media::isobmff::boxes::BoxIter;
|
||||
|
||||
fn be32(b: &[u8], at: usize) -> Option<u64> {
|
||||
b.get(at..at.checked_add(4)?).map(|s| u32::from_be_bytes([s[0], s[1], s[2], s[3]]) as u64)
|
||||
}
|
||||
@@ -43,37 +45,28 @@ fn boxes_fit(b: &[u8], file_len: u64, depth: u32) -> bool {
|
||||
if depth > 16 {
|
||||
return false;
|
||||
}
|
||||
let mut at = 0usize;
|
||||
while b.len() - at >= 8 {
|
||||
let Some(size32) = be32(b, at) else { return false };
|
||||
let kind = &b[at + 4..at + 8];
|
||||
let (header, size) = match size32 {
|
||||
0 => (8, (b.len() - at) as u64),
|
||||
1 => match b.get(at + 8..at + 16) {
|
||||
Some(s) => (16, u64::from_be_bytes(s.try_into().unwrap_or_default())),
|
||||
None => return false,
|
||||
},
|
||||
n => (8, n),
|
||||
};
|
||||
if size < header as u64 || size > (b.len() - at) as u64 {
|
||||
let mut iter = if depth == 0 { BoxIter::new(b).allow_truncated() } else { BoxIter::new(b) };
|
||||
while let Some(item) = iter.next() {
|
||||
// Fewer than 8 trailing bytes are not a box header; symphonia stops there.
|
||||
let Ok(bx) = item else { return b.len().saturating_sub(iter.offset()) < 8 };
|
||||
let kind = &bx.kind.0;
|
||||
if bx.truncated {
|
||||
// A box that runs past the end of the file is fine at the top level (the file was cut
|
||||
// short; symphonia stops there), but never inside a parent.
|
||||
return depth == 0 && !matches!(kind, b"moov" | b"moof");
|
||||
// short; symphonia stops there), but never inside a parent (the iterator rejects it there) or for `moov` / `moof`.
|
||||
return !matches!(kind, b"moov" | b"moof");
|
||||
}
|
||||
let body = &b[at + header..at + size as usize];
|
||||
let ok = if CONTAINERS.iter().any(|c| c.as_slice() == kind) {
|
||||
boxes_fit(body, file_len, depth + 1)
|
||||
let ok = if CONTAINERS.contains(&kind) {
|
||||
boxes_fit(bx.payload, file_len, depth + 1)
|
||||
} else if kind == b"meta" {
|
||||
// ISO `meta` is a full box (4 bytes of version and flags first); QuickTime's is not.
|
||||
let skip = if be32(body, 0) == Some(0) { 4 } else { 0 };
|
||||
boxes_fit(&body[skip.min(body.len())..], file_len, depth + 1)
|
||||
let skip = if be32(bx.payload, 0) == Some(0) { 4 } else { 0 };
|
||||
boxes_fit(&bx.payload[skip.min(bx.payload.len())..], file_len, depth + 1)
|
||||
} else {
|
||||
table_fits(kind, body, file_len)
|
||||
table_fits(kind, bx.payload, file_len)
|
||||
};
|
||||
if !ok {
|
||||
return false;
|
||||
}
|
||||
at += size as usize;
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -122,4 +115,12 @@ mod tests {
|
||||
let far = [&vec![0u8; PROBE_SEARCH_LIMIT + 16][..], &mp4].concat();
|
||||
assert!(probe_fits(&far), "past the probe window symphonia never reads it as an MP4");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn short_tails_and_cut_top_level_boxes() {
|
||||
let ftyp = [&16u32.to_be_bytes()[..], b"ftyp", b"isom", &[0; 4]].concat();
|
||||
assert!(tables_fit(&[&ftyp[..], &[0, 0, 1]].concat()));
|
||||
assert!(tables_fit(&[&ftyp[..], &100u32.to_be_bytes(), b"mdat"].concat()));
|
||||
assert!(!tables_fit(&[&ftyp[..], &100u32.to_be_bytes(), b"moov"].concat()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1362,6 +1362,7 @@ impl Chart {
|
||||
.collect(),
|
||||
kind: Some(ChartType::Line),
|
||||
secondary_axis: true,
|
||||
data_labels: Some(false),
|
||||
..Default::default()
|
||||
});
|
||||
v.y2_min = Some(0.0);
|
||||
|
||||
@@ -626,6 +626,9 @@ pub struct Slide {
|
||||
pub animations: Vec<Animation>,
|
||||
/// Speaker notes.
|
||||
pub notes: TextBody,
|
||||
/// Whether the slide has an associated notes slide even if its text is empty.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub has_notes_slide: bool,
|
||||
pub comments: Vec<Comment>,
|
||||
/// `clrMapOvr`: a colour map replacing the layout's or master's (`bg1`→`dk1`…); None follows
|
||||
/// the layout.
|
||||
@@ -652,6 +655,7 @@ impl Default for Slide {
|
||||
transition: None,
|
||||
animations: vec![],
|
||||
notes: TextBody::default(),
|
||||
has_notes_slide: false,
|
||||
comments: vec![],
|
||||
color_map: None,
|
||||
tags: vec![],
|
||||
|
||||
@@ -15,6 +15,7 @@ craft-cfb.workspace = true
|
||||
craft-drawingml.workspace = true
|
||||
craft-drawingml-table.workspace = true
|
||||
deckcraft-model = { workspace = true }
|
||||
deckcraft-text = { workspace = true }
|
||||
deckcraft-geom = { workspace = true }
|
||||
deckcraft-color = { workspace = true }
|
||||
quick-xml = { workspace = true }
|
||||
|
||||
+23
-5
@@ -887,6 +887,7 @@ fn read_slides(
|
||||
let mut slide = read_slide(imp, &part, doc, *id, layout);
|
||||
if let Some(notes) = slide_notes(imp, &part, &mut owned_parts) {
|
||||
slide.notes = notes;
|
||||
slide.has_notes_slide = true;
|
||||
}
|
||||
read_slide_comments(pkg, pres_part, &part, &mut slide, &mut owned_parts);
|
||||
file_slide_ids.insert(*file_id, *id);
|
||||
@@ -1611,11 +1612,28 @@ fn header_footer(p: &Presentation) -> HeaderFooter {
|
||||
Some(PhType::SlideNum) => hf.slide_number = true,
|
||||
Some(PhType::Date) => {
|
||||
hf.date = true;
|
||||
if let Some(t) = &sh.text
|
||||
&& !t.paragraphs.iter().flat_map(|p| &p.runs).any(|r| matches!(r.kind, deckcraft_model::text::RunKind::Field { .. }))
|
||||
&& hf.date_text.is_empty()
|
||||
{
|
||||
hf.date_text = t.text();
|
||||
let field = sh.text.iter().flat_map(|t| t.paragraphs.iter()).flat_map(|p| p.runs.iter()).find_map(|r| match &r.kind {
|
||||
deckcraft_model::text::RunKind::Field { field } if deckcraft_text::datetime::is_date_field(field) => Some(field.as_str()),
|
||||
_ => None,
|
||||
});
|
||||
match field {
|
||||
// An automatic date: remember which of the thirteen formats it is, so the
|
||||
// Header and Footer dialog opens on the deck's own choice instead of the
|
||||
// default. An unknown spelling (`datetime`, `datetimeFigureOut`) is left
|
||||
// as no choice rather than guessed at.
|
||||
Some(kind) => {
|
||||
if hf.date_format.is_empty() && deckcraft_text::datetime::DATE_KINDS.contains(&kind) {
|
||||
hf.date_format = kind.to_string();
|
||||
}
|
||||
}
|
||||
// A fixed date: its text, as before.
|
||||
None => {
|
||||
if hf.date_text.is_empty()
|
||||
&& let Some(t) = &sh.text
|
||||
{
|
||||
hf.date_text = t.text();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(PhType::Footer) => {
|
||||
|
||||
+120
-15
@@ -57,14 +57,44 @@ struct Found<'a> {
|
||||
group: usize,
|
||||
/// Sum of the start delays of the time nodes between the click group and the effect, in ms.
|
||||
offset: u32,
|
||||
/// Whether any ancestor time node defers start until an event (`onClick`, `onEnd`, targeted `onBegin`) or nonzero delay.
|
||||
deferred: bool,
|
||||
}
|
||||
|
||||
/// Where `collect` is in the time tree: the click group and the delay accumulated inside it.
|
||||
#[derive(Clone, Copy)]
|
||||
struct At {
|
||||
trigger: Option<u32>,
|
||||
main_seq_id: Option<u32>,
|
||||
group: usize,
|
||||
offset: u32,
|
||||
deferred: bool,
|
||||
}
|
||||
|
||||
/// Returns whether `st` (`p:stCondLst`) is PowerPoint's automatic main-sequence step wrapper:
|
||||
/// `<p:cond delay="indefinite"/>` paired only with `<p:cond evt="onBegin" delay="0"><p:tn val="{main_seq_id}"/></p:cond>`
|
||||
/// referencing the immediate enclosing `mainSeq` `<p:cTn>`.
|
||||
fn is_main_seq_auto(st: &El, main_seq_id: Option<u32>) -> bool {
|
||||
let Some(ms_id) = main_seq_id else {
|
||||
return false;
|
||||
};
|
||||
let is_indefinite = |d: &El| {
|
||||
d.attr("evt").is_none()
|
||||
&& d.attr("delay").map(str::trim) == Some("indefinite")
|
||||
&& d.child("tgtEl").is_none()
|
||||
&& d.child("tn").is_none()
|
||||
&& d.child("rtn").is_none()
|
||||
};
|
||||
let is_main_seq_on_begin = |d: &El| {
|
||||
d.attr("evt") == Some("onBegin")
|
||||
&& d.attr("delay").map(str::trim) == Some("0")
|
||||
&& d.child("tgtEl").is_none()
|
||||
&& d.child("rtn").is_none()
|
||||
&& d.child("tn").and_then(|tn| tn.u32("val")) == Some(ms_id)
|
||||
};
|
||||
st.children_named("cond").any(is_indefinite)
|
||||
&& st.children_named("cond").any(is_main_seq_on_begin)
|
||||
&& st.children_named("cond").all(|d| is_indefinite(d) || is_main_seq_on_begin(d))
|
||||
}
|
||||
|
||||
fn collect<'a>(e: &'a El, at: At, groups: &mut usize, out: &mut Vec<Found<'a>>, depth: usize) {
|
||||
@@ -73,7 +103,8 @@ fn collect<'a>(e: &'a El, at: At, groups: &mut usize, out: &mut Vec<Found<'a>>,
|
||||
}
|
||||
for c in e.elements() {
|
||||
if c.is("cTn") && c.has_attr("presetClass") {
|
||||
out.push(Found { ctn: c, trigger: at.trigger, group: at.group, offset: at.offset });
|
||||
let deferred = at.deferred || c.child("stCondLst").is_some_and(defers_start);
|
||||
out.push(Found { ctn: c, trigger: at.trigger, group: at.group, offset: at.offset, deferred });
|
||||
continue;
|
||||
}
|
||||
let mut at = at;
|
||||
@@ -82,17 +113,25 @@ fn collect<'a>(e: &'a El, at: At, groups: &mut usize, out: &mut Vec<Found<'a>>,
|
||||
&& ctn.attr("nodeType") == Some("interactiveSeq")
|
||||
{
|
||||
at.trigger = ctn.path(&["stCondLst", "cond", "tgtEl", "spTgt"]).and_then(|s| s.u32("spid"));
|
||||
at.main_seq_id = None;
|
||||
}
|
||||
if c.is("cTn")
|
||||
&& let Some(cond) = c.path(&["stCondLst", "cond"])
|
||||
{
|
||||
if cond.attr("delay").map(str::trim) == Some("indefinite") {
|
||||
*groups += 1;
|
||||
at.group = *groups;
|
||||
at.offset = 0;
|
||||
} else {
|
||||
at.offset = at.offset.saturating_add(ms_attr(cond, "delay").unwrap_or(0));
|
||||
if c.is("cTn") {
|
||||
let is_main_seq = c.attr("nodeType") == Some("mainSeq");
|
||||
if let Some(st) = c.child("stCondLst") {
|
||||
if !(!is_main_seq && !at.deferred && is_main_seq_auto(st, at.main_seq_id)) && defers_start(st) {
|
||||
at.deferred = true;
|
||||
}
|
||||
if let Some(cond) = st.child("cond") {
|
||||
if cond.attr("delay").map(str::trim) == Some("indefinite") {
|
||||
*groups += 1;
|
||||
at.group = *groups;
|
||||
at.offset = 0;
|
||||
} else {
|
||||
at.offset = at.offset.saturating_add(ms_attr(cond, "delay").unwrap_or(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
at.main_seq_id = if is_main_seq && !at.deferred { c.u32("id") } else { None };
|
||||
}
|
||||
collect(c, at, groups, out, depth + 1);
|
||||
}
|
||||
@@ -207,12 +246,44 @@ fn behaviour_auto_reverses(c: &El) -> bool {
|
||||
|
||||
/// Volume, mute, Loop until Stopped, Hide While Not Playing and Play Full Screen live in the timing tree
|
||||
/// (`p:video`/`p:audio` > `p:cMediaNode`), not on the picture: copy them onto the target's `MediaClip`.
|
||||
/// Returns whether `st` (`p:stCondLst`) defers playback instead of starting immediately on slide entry.
|
||||
fn defers_start(st: &El) -> bool {
|
||||
let is_auto_begin = |c: &El| {
|
||||
c.attr("evt") == Some("onBegin")
|
||||
&& c.attr("delay").map(str::trim) == Some("0")
|
||||
&& c.child("tgtEl").is_none()
|
||||
&& c.child("tn").is_none()
|
||||
&& c.child("rtn").is_none()
|
||||
};
|
||||
let has_on_begin = st.children_named("cond").any(is_auto_begin);
|
||||
st.children_named("cond")
|
||||
.any(|c| (c.attr("evt").is_some() && !is_auto_begin(c)) || (!has_on_begin && c.attr("delay").map(str::trim) != Some("0")))
|
||||
}
|
||||
|
||||
/// Applies `p:video`/`p:audio` timing node settings and main-sequence autoplay triggers to media shapes.
|
||||
pub fn media_settings(timing: &El, ctx: &IdCtx, shapes: &mut [Shape]) {
|
||||
let mut nodes = vec![];
|
||||
for tag in ["video", "audio"] {
|
||||
timing.find_all(tag, &mut nodes);
|
||||
fn collect_media<'a>(e: &'a El, deferred: bool, out: &mut Vec<(&'a El, bool)>, depth: usize) {
|
||||
if depth > 64 || out.len() >= 10_000 {
|
||||
return;
|
||||
}
|
||||
let mut deferred = deferred;
|
||||
if e.is("cTn")
|
||||
&& let Some(st) = e.child("stCondLst")
|
||||
&& defers_start(st)
|
||||
{
|
||||
deferred = true;
|
||||
}
|
||||
if e.is("video") || e.is("audio") {
|
||||
out.push((e, deferred));
|
||||
return;
|
||||
}
|
||||
for c in e.elements() {
|
||||
collect_media(c, deferred, out, depth + 1);
|
||||
}
|
||||
}
|
||||
for node in nodes.into_iter().take(10_000) {
|
||||
let mut nodes = vec![];
|
||||
collect_media(timing, false, &mut nodes, 0);
|
||||
for (node, deferred) in nodes {
|
||||
let Some(cm) = node.child("cMediaNode") else { continue };
|
||||
let Some(id) = cm.path(&["tgtEl", "spTgt"]).and_then(|t| t.u32("spid")).and_then(|f| ctx.lookup(f)) else { continue };
|
||||
let Some(ShapeKind::Media(clip)) = find_shape_mut(shapes, id).map(|s| &mut s.kind) else { continue };
|
||||
@@ -228,10 +299,44 @@ pub fn media_settings(timing: &El, ctx: &IdCtx, shapes: &mut [Shape]) {
|
||||
if cm.child("cTn").and_then(|c| c.attr("repeatCount")) == Some("indefinite") {
|
||||
clip.loop_play = true;
|
||||
}
|
||||
if cm.child("cTn").and_then(|c| c.attr("fill")) == Some("remove") {
|
||||
clip.rewind = true;
|
||||
}
|
||||
if cm.u32("numSld").is_some_and(|n| n > 1) {
|
||||
clip.play_across_slides = true;
|
||||
}
|
||||
if !deferred && cm.path(&["cTn", "stCondLst", "cond"]).is_some_and(|c| c.attr("evt").is_none() && c.attr("delay").map(str::trim) == Some("0"))
|
||||
{
|
||||
clip.autoplay = true;
|
||||
}
|
||||
if node.bool("fullScrn") == Some(true) {
|
||||
clip.full_screen = true;
|
||||
}
|
||||
}
|
||||
let root_deferred = timing.path(&["tnLst", "par", "cTn", "stCondLst"]).is_some_and(defers_start);
|
||||
if !root_deferred && let Some(tn) = timing.child("tnLst") {
|
||||
let mut found = vec![];
|
||||
collect(tn, At { trigger: None, main_seq_id: None, group: 0, offset: 0, deferred: false }, &mut 0, &mut found, 0);
|
||||
for f in found.into_iter().filter(|f| f.trigger.is_none()) {
|
||||
let c = f.ctn;
|
||||
if c.attr("nodeType") == Some("clickEffect") || f.deferred {
|
||||
break;
|
||||
}
|
||||
let class = AnimClass::from_xml(c.attr("presetClass").unwrap_or("entr"));
|
||||
let preset = c.u32("presetID").unwrap_or(0);
|
||||
let effect = maps::effect_for_preset(class, preset).unwrap_or_else(|| maps::fallback_effect(class));
|
||||
let delay = c.path(&["stCondLst", "cond"]).and_then(|d| ms_attr(d, "delay")).unwrap_or(0);
|
||||
if class == AnimClass::Media
|
||||
&& effect == "play"
|
||||
&& f.offset == 0
|
||||
&& delay == 0
|
||||
&& let Some(id) = c.find("spTgt").and_then(|t| t.u32("spid")).and_then(|s| ctx.lookup(s))
|
||||
&& let Some(ShapeKind::Media(clip)) = find_shape_mut(shapes, id).map(|s| &mut s.kind)
|
||||
{
|
||||
clip.autoplay = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Flatten the timing tree into the Animation Pane list.
|
||||
@@ -239,7 +344,7 @@ pub fn animations(imp: &mut Imp, part: &Part, ctx: &IdCtx, timing: &El, shapes:
|
||||
let _ = (imp, part);
|
||||
let Some(tn) = timing.child("tnLst") else { return vec![] };
|
||||
let mut found = vec![];
|
||||
collect(tn, At { trigger: None, group: 0, offset: 0 }, &mut 0, &mut found, 0);
|
||||
collect(tn, At { trigger: None, main_seq_id: None, group: 0, offset: 0, deferred: false }, &mut 0, &mut found, 0);
|
||||
// Paragraph builds (`bldP`) by (spid, grpId) -> whether `build="p"`.
|
||||
let bld_p: std::collections::HashMap<(u32, String), bool> = timing
|
||||
.child("bldLst")
|
||||
|
||||
@@ -429,7 +429,7 @@ struct NotesMasterWrite {
|
||||
fn notes_master_write(p: &Presentation) -> Option<NotesMasterWrite> {
|
||||
let nm = p.notes_master.as_deref();
|
||||
let kept = nm.filter(|m| !m.shapes.is_empty());
|
||||
let has_notes = p.slides.iter().any(|s| !s.notes.is_empty());
|
||||
let has_notes = p.slides.iter().any(|s| !s.notes.is_empty() || s.has_notes_slide);
|
||||
if !has_notes && nm.is_none() {
|
||||
return None;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ pub fn export(p: &Presentation, main_ct: &str) -> Result<Vec<u8>, PptxError> {
|
||||
if let Some(lp) = layout_parts.get(&s.layout) {
|
||||
so.rels.add("slideLayout", &opc::relative(&sname, lp), false);
|
||||
}
|
||||
if !s.notes.is_empty() {
|
||||
if !s.notes.is_empty() || s.has_notes_slide {
|
||||
let nname = format!("ppt/notesSlides/notesSlide{}.xml", i + 1);
|
||||
so.rels.add("notesSlide", &opc::relative(&sname, &nname), false);
|
||||
let mut no = Out::new(&nname);
|
||||
@@ -822,9 +822,7 @@ fn slide_xml(x: &mut Exp, o: &mut Out, s: &Slide, comment_rel: Option<&str>) ->
|
||||
if let Some(t) = &s.transition {
|
||||
timing::transition(&mut w, x, o, t);
|
||||
}
|
||||
if !s.animations.is_empty() {
|
||||
timing::timing(&mut w, x, &s.animations, &s.shapes, &ids);
|
||||
}
|
||||
timing::timing(&mut w, x, &s.animations, &s.shapes, &ids);
|
||||
slide_ext_list(&mut w, s.raw_ext.as_deref(), comment_rel);
|
||||
w.close("p:sld");
|
||||
w.finish()
|
||||
@@ -1310,7 +1308,7 @@ fn app_xml(p: &Presentation) -> Vec<u8> {
|
||||
);
|
||||
w.elt("Application", "DeckCraft");
|
||||
w.elt("Slides", &p.slides.len().to_string());
|
||||
w.elt("Notes", &p.slides.iter().filter(|s| !s.notes.is_empty()).count().to_string());
|
||||
w.elt("Notes", &p.slides.iter().filter(|s| !s.notes.is_empty() || s.has_notes_slide).count().to_string());
|
||||
w.elt("HiddenSlides", &p.slides.iter().filter(|s| s.hidden).count().to_string());
|
||||
if !p.props.company.is_empty() {
|
||||
w.elt("Company", &p.props.company);
|
||||
|
||||
@@ -592,7 +592,7 @@ fn shape_index<'a>(shapes: &'a [Shape], depth: usize, out: &mut std::collections
|
||||
}
|
||||
}
|
||||
|
||||
/// Write `p:timing` for a slide's animations.
|
||||
/// Write `p:timing` for a slide's animations and media settings.
|
||||
pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idmap: &IdMap) {
|
||||
let mut grp_count: std::collections::HashMap<u32, u32> = Default::default();
|
||||
let mut main: Vec<Eff> = vec![];
|
||||
@@ -686,7 +686,8 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm
|
||||
None => main.extend(effs),
|
||||
}
|
||||
}
|
||||
if main.is_empty() && triggered.is_empty() {
|
||||
let media = collect_media(shapes, idmap);
|
||||
if main.is_empty() && triggered.is_empty() && media.is_empty() {
|
||||
return;
|
||||
}
|
||||
let mut ids = Ids(0);
|
||||
@@ -757,6 +758,9 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm
|
||||
w.close("p:nextCondLst");
|
||||
w.close("p:seq");
|
||||
}
|
||||
for (spid, clip) in &media {
|
||||
write_media_node(w, &mut ids, *spid, clip);
|
||||
}
|
||||
w.close("p:childTnLst");
|
||||
w.close("p:cTn");
|
||||
w.close("p:par");
|
||||
@@ -770,3 +774,57 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm
|
||||
}
|
||||
w.close("p:timing");
|
||||
}
|
||||
|
||||
/// Collects media shapes on the slide that have non-default playback settings requiring a `p:video`/`p:audio` timing node.
|
||||
fn collect_media<'a>(shapes: &'a [Shape], idmap: &IdMap) -> Vec<(u32, &'a deckcraft_model::MediaClip)> {
|
||||
let mut media = Vec::new();
|
||||
deckcraft_model::walk(shapes, &mut |shape, _| {
|
||||
if let ShapeKind::Media(clip) = &shape.kind
|
||||
&& (clip.autoplay
|
||||
|| (clip.volume - 1.0).abs() > 1e-6
|
||||
|| clip.hide_while_not_playing
|
||||
|| clip.loop_play
|
||||
|| clip.rewind
|
||||
|| clip.play_across_slides
|
||||
|| (clip.video && clip.full_screen))
|
||||
&& let Some(spid) = idmap.get(shape.id)
|
||||
{
|
||||
media.push((spid, clip));
|
||||
}
|
||||
});
|
||||
media
|
||||
}
|
||||
|
||||
/// Writes a `p:video` or `p:audio` media timing node (`p:cMediaNode`) for a media shape.
|
||||
fn write_media_node(w: &mut W, ids: &mut Ids, spid: u32, clip: &deckcraft_model::MediaClip) {
|
||||
let tag = if clip.video { "p:video" } else { "p:audio" };
|
||||
w.open(tag, A::new().t("fullScrn", clip.video && clip.full_screen));
|
||||
let mut cm = A::new().a("vol", (clip.volume.clamp(0.0, 1.0) * 100_000.0).round() as u32);
|
||||
if clip.volume <= 1e-6 {
|
||||
cm = cm.t("mute", true);
|
||||
}
|
||||
if clip.hide_while_not_playing {
|
||||
cm = cm.a("showWhenStopped", 0);
|
||||
}
|
||||
if clip.play_across_slides {
|
||||
cm = cm.a("numSld", 999);
|
||||
}
|
||||
w.open("p:cMediaNode", cm);
|
||||
w.open(
|
||||
"p:cTn",
|
||||
A::new()
|
||||
.a("id", ids.next())
|
||||
.a("fill", if clip.rewind { "remove" } else { "hold" })
|
||||
.a("display", 0)
|
||||
.o("repeatCount", clip.loop_play.then_some("indefinite")),
|
||||
);
|
||||
w.open0("p:stCondLst");
|
||||
w.empty("p:cond", A::new().a("delay", if clip.autoplay { "0" } else { "indefinite" }));
|
||||
w.close("p:stCondLst");
|
||||
w.close("p:cTn");
|
||||
w.open0("p:tgtEl");
|
||||
w.empty("p:spTgt", A::new().a("spid", spid));
|
||||
w.close("p:tgtEl");
|
||||
w.close("p:cMediaNode");
|
||||
w.close(tag);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//! The Header & Footer date through PPTX: an automatic date's format comes back on import, so the
|
||||
//! dialog opens on the deck's own choice; a fixed date still comes back as its text.
|
||||
|
||||
use deckcraft_model::{Presentation, defaults};
|
||||
use serde_json::json;
|
||||
|
||||
/// A deck whose Date placeholders are set up by the engine, exported and imported again.
|
||||
fn round_trip(args: serde_json::Value) -> Presentation {
|
||||
let mut s = deckcraft_engine::Session::with_new();
|
||||
s.execute("design.headerFooter", &args).expect("headerFooter");
|
||||
let p = s.doc().expect("doc").doc.clone();
|
||||
let bytes = deckcraft_pptx::export(&p).expect("export");
|
||||
deckcraft_pptx::import(&bytes).expect("import")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_automatic_dates_format_survives_a_round_trip() {
|
||||
// A chosen format comes back as the remembered choice.
|
||||
let q = round_trip(json!({"date": true, "dateFormat": "datetime5", "all": true}));
|
||||
assert!(q.header_footer.date, "the date placeholder is there");
|
||||
assert_eq!(q.header_footer.date_format, "datetime5", "the format is remembered");
|
||||
assert_eq!(q.header_footer.date_text, "", "an automatic date has no fixed text");
|
||||
|
||||
// A different one, so the test cannot pass by always reading datetime5.
|
||||
let q = round_trip(json!({"date": true, "dateFormat": "datetime11", "all": true}));
|
||||
assert_eq!(q.header_footer.date_format, "datetime11");
|
||||
|
||||
// The default: no format asked for, so nothing to remember beyond the field itself.
|
||||
let q = round_trip(json!({"date": true, "all": true}));
|
||||
assert_eq!(q.header_footer.date_format, "datetime1", "the placeholder's own field is datetime1");
|
||||
|
||||
// A fixed date is text, not a field: its text comes back and no format is claimed.
|
||||
let q = round_trip(json!({"date": true, "dateText": "4 July 1776", "all": true}));
|
||||
assert_eq!(q.header_footer.date_text, "4 July 1776");
|
||||
assert_eq!(q.header_footer.date_format, "", "a fixed date has no format");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_deck_without_a_date_placeholder_claims_no_format() {
|
||||
let p = defaults::new_presentation(None);
|
||||
let bytes = deckcraft_pptx::export(&p).expect("export");
|
||||
let q = deckcraft_pptx::import(&bytes).expect("import");
|
||||
assert!(!q.header_footer.date);
|
||||
assert_eq!(q.header_footer.date_format, "");
|
||||
}
|
||||
@@ -74,3 +74,129 @@ fn muted_audio_has_no_volume_and_other_clips_keep_theirs() {
|
||||
assert_eq!(c[0].volume, 1.0);
|
||||
assert_eq!((c[1].volume, c[1].loop_play, c[1].full_screen), (0.0, false, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn media_autoplay_respects_ancestor_conditions_and_delays() {
|
||||
let immediate = clips(|v, a| {
|
||||
format!(
|
||||
r#"<p:par><p:cTn id="2" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:video><p:cMediaNode><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video></p:childTnLst></p:cTn></p:par><p:par><p:cTn id="4" fill="hold"><p:stCondLst><p:cond evt="onBegin" delay="0"/></p:stCondLst><p:childTnLst><p:audio><p:cMediaNode><p:cTn id="5" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{a}"/></p:tgtEl></p:cMediaNode></p:audio></p:childTnLst></p:cTn></p:par>"#
|
||||
)
|
||||
});
|
||||
assert!(immediate[0].autoplay, "delay=0 ancestor allows autoplay");
|
||||
assert!(immediate[1].autoplay, "untargeted onBegin delay=0 ancestor allows autoplay");
|
||||
|
||||
let delayed_and_onclick = clips(|v, a| {
|
||||
format!(
|
||||
r#"<p:par><p:cTn id="2" fill="hold"><p:stCondLst><p:cond delay="2000"/></p:stCondLst><p:childTnLst><p:video><p:cMediaNode><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video></p:childTnLst></p:cTn></p:par><p:par><p:cTn id="4" fill="hold"><p:stCondLst><p:cond evt="onClick" delay="0"/></p:stCondLst><p:childTnLst><p:audio><p:cMediaNode><p:cTn id="5" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{a}"/></p:tgtEl></p:cMediaNode></p:audio></p:childTnLst></p:cTn></p:par>"#
|
||||
)
|
||||
});
|
||||
assert!(!delayed_and_onclick[0].autoplay, "delayed ancestor blocks autoplay");
|
||||
assert!(!delayed_and_onclick[1].autoplay, "onClick ancestor blocks autoplay");
|
||||
|
||||
let targeted_tn_and_own_cond = clips(|v, a| {
|
||||
format!(
|
||||
r#"<p:par><p:cTn id="2" fill="hold"><p:stCondLst><p:cond evt="onBegin" delay="0"><p:tn val="2"/></p:cond></p:stCondLst><p:childTnLst><p:video><p:cMediaNode><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video></p:childTnLst></p:cTn></p:par><p:par><p:cTn id="4" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:audio><p:cMediaNode><p:cTn id="5" fill="hold"><p:stCondLst><p:cond evt="onBegin" delay="0"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{a}"/></p:tgtEl></p:cMediaNode></p:audio></p:childTnLst></p:cTn></p:par>"#
|
||||
)
|
||||
});
|
||||
assert!(!targeted_tn_and_own_cond[0].autoplay, "targeted onBegin ancestor blocks autoplay");
|
||||
assert!(!targeted_tn_and_own_cond[1].autoplay, "media cond with explicit evt is not autoplay");
|
||||
|
||||
let delayed_media_cond = clips(|v, _| {
|
||||
format!(
|
||||
r#"<p:par><p:cTn id="2" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:video><p:cMediaNode><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="500"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video></p:childTnLst></p:cTn></p:par>"#
|
||||
)
|
||||
});
|
||||
assert!(!delayed_media_cond[0].autoplay, "non-zero media cond delay is not autoplay");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn media_only_slide_exports_and_round_trips_video_and_audio_timing_nodes() {
|
||||
let mut p = defaults::new_presentation(None);
|
||||
let video = p.add_media("clip.mp4", "video/mp4", b"video".to_vec()).expect("media");
|
||||
let audio = p.add_media("clip.m4a", "audio/mp4", b"audio".to_vec()).expect("media");
|
||||
let vid_id = ShapeId(p.alloc_id().expect("id"));
|
||||
let aud_id = ShapeId(p.alloc_id().expect("id"));
|
||||
let s0 = Arc::make_mut(&mut p.slides[0]);
|
||||
s0.shapes.push(deckcraft_model::Shape {
|
||||
id: vid_id,
|
||||
name: "AutoplayVideo".into(),
|
||||
xfrm: Some(Xfrm::new(40.0, 40.0, 200.0, 100.0)),
|
||||
kind: ShapeKind::Media(MediaClip {
|
||||
media: video,
|
||||
video: true,
|
||||
autoplay: true,
|
||||
volume: 0.75,
|
||||
hide_while_not_playing: true,
|
||||
loop_play: true,
|
||||
rewind: true,
|
||||
play_across_slides: true,
|
||||
full_screen: true,
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
});
|
||||
s0.shapes.push(deckcraft_model::Shape {
|
||||
id: aud_id,
|
||||
name: "ManualMutedAudio".into(),
|
||||
xfrm: Some(Xfrm::new(40.0, 160.0, 200.0, 100.0)),
|
||||
kind: ShapeKind::Media(MediaClip { media: audio, video: false, autoplay: false, volume: 0.0, loop_play: true, ..Default::default() }),
|
||||
..Default::default()
|
||||
});
|
||||
let bytes = deckcraft_pptx::export(&p).expect("export");
|
||||
let back = deckcraft_pptx::import(&bytes).expect("import");
|
||||
let clips: Vec<&MediaClip> = back.slides[0]
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|s| match &s.kind {
|
||||
ShapeKind::Media(m) => Some(m),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(clips.len(), 2);
|
||||
assert!(
|
||||
clips[0].video
|
||||
&& clips[0].autoplay
|
||||
&& clips[0].hide_while_not_playing
|
||||
&& clips[0].loop_play
|
||||
&& clips[0].rewind
|
||||
&& clips[0].play_across_slides
|
||||
&& clips[0].full_screen
|
||||
);
|
||||
assert!((clips[0].volume - 0.75).abs() < 1e-4);
|
||||
assert!(
|
||||
!clips[1].video
|
||||
&& !clips[1].autoplay
|
||||
&& clips[1].loop_play
|
||||
&& !clips[1].rewind
|
||||
&& !clips[1].play_across_slides
|
||||
&& !clips[1].hide_while_not_playing
|
||||
&& !clips[1].full_screen
|
||||
);
|
||||
assert_eq!(clips[1].volume, 0.0);
|
||||
|
||||
// Main-sequence automatic Play (mediacall) effect with indefinite media node also sets autoplay.
|
||||
let main_seq_play = self::clips(|v, _| {
|
||||
format!(
|
||||
r#"<p:seq concurrent="1" nextAc="seek"><p:cTn id="2" dur="indefinite" nodeType="mainSeq"><p:childTnLst><p:par><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="indefinite"/><p:cond evt="onBegin" delay="0"><p:tn val="2"/></p:cond></p:stCondLst><p:childTnLst><p:par><p:cTn id="4" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:par><p:cTn id="5" presetID="1" presetClass="mediacall" presetSubtype="0" fill="hold" nodeType="withEffect"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:cmd type="call" cmd="playFrom(0.0)"><p:cBhvr><p:cTn id="6" dur="1" fill="hold"/><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cBhvr></p:cmd></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:seq><p:video><p:cMediaNode><p:cTn id="7" fill="hold"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video>"#
|
||||
)
|
||||
});
|
||||
assert!(main_seq_play[0].autoplay, "main-sequence automatic Play effect sets autoplay");
|
||||
|
||||
// An `indefinite` + `onBegin delay="0"` condition whose `<p:tn>` references a different
|
||||
// click-dependent time node rather than the enclosing `mainSeq` must stay deferred.
|
||||
let non_main_seq_tn_play = self::clips(|v, _| {
|
||||
format!(
|
||||
r#"<p:seq concurrent="1" nextAc="seek"><p:cTn id="2" dur="indefinite" nodeType="mainSeq"><p:childTnLst><p:par><p:cTn id="99" fill="hold"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst><p:childTnLst><p:par><p:cTn id="100" fill="hold"><p:stCondLst><p:cond evt="onClick" delay="0"/></p:stCondLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par><p:par><p:cTn id="3" fill="hold"><p:stCondLst><p:cond delay="indefinite"/><p:cond evt="onBegin" delay="0"><p:tn val="99"/></p:cond></p:stCondLst><p:childTnLst><p:par><p:cTn id="4" fill="hold"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:par><p:cTn id="5" presetID="1" presetClass="mediacall" presetSubtype="0" fill="hold" nodeType="withEffect"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:cmd type="call" cmd="playFrom(0.0)"><p:cBhvr><p:cTn id="6" dur="1" fill="hold"/><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cBhvr></p:cmd></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:seq><p:video><p:cMediaNode><p:cTn id="7" fill="hold"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video>"#
|
||||
)
|
||||
});
|
||||
assert!(!non_main_seq_tn_play[0].autoplay, "onBegin referencing non-mainSeq click-dependent node is not autoplay");
|
||||
|
||||
// Command-based Play beneath an onClick or onEnd ancestor must not set autoplay.
|
||||
let deferred_cmd_play = self::clips(|v, a| {
|
||||
format!(
|
||||
r#"<p:par><p:cTn id="2" fill="hold"><p:stCondLst><p:cond evt="onClick" delay="0"/></p:stCondLst><p:childTnLst><p:par><p:cTn id="3" presetID="1" presetClass="mediacall" presetSubtype="0" fill="hold" nodeType="withEffect"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:cmd type="call" cmd="playFrom(0.0)"><p:cBhvr><p:cTn id="4" dur="1" fill="hold"/><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cBhvr></p:cmd></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par><p:par><p:cTn id="5" fill="hold"><p:stCondLst><p:cond evt="onEnd" delay="0"><p:tn val="2"/></p:cond></p:stCondLst><p:childTnLst><p:par><p:cTn id="6" presetID="1" presetClass="mediacall" presetSubtype="0" fill="hold" nodeType="withEffect"><p:stCondLst><p:cond delay="0"/></p:stCondLst><p:childTnLst><p:cmd type="call" cmd="playFrom(0.0)"><p:cBhvr><p:cTn id="7" dur="1" fill="hold"/><p:tgtEl><p:spTgt spid="{a}"/></p:tgtEl></p:cBhvr></p:cmd></p:childTnLst></p:cTn></p:par></p:childTnLst></p:cTn></p:par><p:video><p:cMediaNode><p:cTn id="8" fill="hold" display="0"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{v}"/></p:tgtEl></p:cMediaNode></p:video><p:audio><p:cMediaNode><p:cTn id="9" fill="hold" display="0"><p:stCondLst><p:cond delay="indefinite"/></p:stCondLst></p:cTn><p:tgtEl><p:spTgt spid="{a}"/></p:tgtEl></p:cMediaNode></p:audio>"#
|
||||
)
|
||||
});
|
||||
assert!(!deferred_cmd_play[0].autoplay, "command-based Play under onClick ancestor is not autoplay");
|
||||
assert!(!deferred_cmd_play[1].autoplay, "command-based Play under onEnd ancestor is not autoplay");
|
||||
}
|
||||
|
||||
@@ -14,6 +14,31 @@ const NOTES: &str = "ppt/notesSlides/notesSlide1.xml";
|
||||
/// label and plain text), a level-2 paragraph with buNone, and a closing plain line.
|
||||
const NOTES_XML: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:rPr lang="sk-SK" b="1" dirty="0"/><a:t>Metodický prehľad</a:t></a:r></a:p><a:p><a:r><a:rPr lang="sk-SK" dirty="0"/><a:t>Žiaci pracujú vo dvojiciach.</a:t></a:r></a:p><a:p><a:pPr marL="285750" lvl="1" indent="-285750"><a:buFont typeface="Wingdings" panose="05000000000000000000" pitchFamily="2" charset="2"/><a:buChar char="§"/></a:pPr><a:r><a:rPr lang="sk-SK" b="1" dirty="0"/><a:t>Cieľ: </a:t></a:r><a:r><a:rPr lang="sk-SK" dirty="0"/><a:t>vysvetliť cyklus</a:t></a:r></a:p><a:p><a:pPr marL="285750" lvl="1" indent="-285750"><a:buFont typeface="Wingdings" panose="05000000000000000000" pitchFamily="2" charset="2"/><a:buChar char="§"/></a:pPr><a:r><a:rPr lang="sk-SK" i="1" dirty="0"/><a:t>Reflexia</a:t></a:r></a:p><a:p><a:pPr marL="285750" lvl="1" indent="-285750"><a:buNone/></a:pPr><a:r><a:rPr lang="sk-SK" dirty="0"/><a:t>Bez odrážky</a:t></a:r></a:p><a:p><a:r><a:rPr lang="sk-SK" dirty="0"/><a:t>Pomôcky: počítač</a:t></a:r></a:p></p:txBody></p:sp></p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:notes>"#;
|
||||
const EMPTY_NOTES_XML: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Slide Image Placeholder 1"/><p:cNvSpPr><a:spLocks noGrp="1" noRot="1" noChangeAspect="1"/></p:cNvSpPr><p:nvPr><p:ph type="sldImg"/></p:nvPr></p:nvSpPr><p:spPr/></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Notes Placeholder 2"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p/></p:txBody></p:sp></p:spTree></p:cSld></p:notes>"#;
|
||||
|
||||
fn empty_notes_deck() -> Vec<u8> {
|
||||
let mut p = defaults::new_presentation(None);
|
||||
Arc::make_mut(&mut p.slides[0]).notes = TextBody::from_text("placeholder");
|
||||
let bytes = deckcraft_pptx::export(&p).expect("export");
|
||||
let mut src = zip::ZipArchive::new(Cursor::new(bytes)).expect("zip");
|
||||
let mut out = zip::ZipWriter::new(Cursor::new(Vec::new()));
|
||||
let mut found = false;
|
||||
for i in 0..src.len() {
|
||||
let mut f = src.by_index(i).expect("entry");
|
||||
let name = f.name().to_string();
|
||||
let mut data = vec![];
|
||||
f.read_to_end(&mut data).expect("read");
|
||||
if name == NOTES {
|
||||
data = EMPTY_NOTES_XML.as_bytes().to_vec();
|
||||
found = true;
|
||||
}
|
||||
out.start_file(name, zip::write::SimpleFileOptions::default()).expect("start");
|
||||
out.write_all(&data).expect("write");
|
||||
}
|
||||
assert!(found, "the export has no {NOTES}");
|
||||
out.finish().expect("finish").into_inner()
|
||||
}
|
||||
|
||||
/// A deck with one notes slide, its notes replaced by [`NOTES_XML`].
|
||||
fn deck() -> Vec<u8> {
|
||||
@@ -80,3 +105,26 @@ fn notes_formatting_survives_a_round_trip() {
|
||||
assert!(xml.contains(r#"lvl="1""#) && xml.contains(r#"marL="285750""#) && xml.contains(r#"indent="-285750""#), "{xml}");
|
||||
assert!(xml.contains(r#"<a:buFont typeface="Wingdings""#) && xml.contains("<a:buChar") && xml.contains("<a:buNone/>"), "{xml}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_notes_slide_is_preserved_on_save_and_reopen() {
|
||||
let raw = empty_notes_deck();
|
||||
let p = deckcraft_pptx::import(&raw).expect("import");
|
||||
assert!(p.slides[0].notes.is_empty(), "imported notes text is empty");
|
||||
assert!(p.slides[0].has_notes_slide, "slide notes presence is captured");
|
||||
|
||||
let saved = deckcraft_pptx::export(&p).expect("export");
|
||||
let mut z = zip::ZipArchive::new(Cursor::new(&saved)).expect("zip");
|
||||
assert!(z.by_name(NOTES).is_ok(), "empty notes slide part is kept in saved package");
|
||||
let mut rels_xml = String::new();
|
||||
z.by_name("ppt/slides/_rels/slide1.xml.rels").expect("slide rels").read_to_string(&mut rels_xml).expect("read slide rels");
|
||||
assert!(rels_xml.contains("notesSlide"), "slide points to notes slide: {rels_xml}");
|
||||
|
||||
let again = deckcraft_pptx::import(&saved).expect("reimport");
|
||||
assert!(again.slides[0].notes.is_empty());
|
||||
assert!(again.slides[0].has_notes_slide, "notes slide presence survives roundtrip");
|
||||
|
||||
let saved_again = deckcraft_pptx::export(&again).expect("export again");
|
||||
let mut z2 = zip::ZipArchive::new(Cursor::new(saved_again)).expect("zip");
|
||||
assert!(z2.by_name(NOTES).is_ok(), "empty notes slide part is kept on subsequent export");
|
||||
}
|
||||
|
||||
@@ -494,6 +494,7 @@ fn draw_inner(ctx: &mut RenderContext, rctx: &Ctx, c: &Chart, frame: ChartFrame<
|
||||
to_axis: &to_axis,
|
||||
zero,
|
||||
base,
|
||||
text_color: text_col,
|
||||
error_marks: &mut err_marks,
|
||||
},
|
||||
);
|
||||
@@ -886,6 +887,7 @@ struct LineDrawing<'a, 'ctx> {
|
||||
to_axis: &'a dyn Fn(bool, f64) -> f64,
|
||||
zero: f64,
|
||||
base: f64,
|
||||
text_color: Rgba,
|
||||
error_marks: &'a mut Vec<(f64, f64, f64, f64, bool)>,
|
||||
}
|
||||
|
||||
@@ -914,10 +916,13 @@ fn draw_lines(ctx: &mut RenderContext, draw: &mut LineDrawing<'_, '_>) {
|
||||
let col = if area_kind { series_fill(rctx, c, si, Some(s)) } else { series_line(rctx, c, si, s) };
|
||||
let series_stats = s.error_bars.as_ref().map(|_| deckcraft_model::chart::SeriesStats::of(&s.values));
|
||||
let mut pts = vec![];
|
||||
// Each point's own value (not the stacked total), for its data label.
|
||||
let mut values = vec![];
|
||||
// Whether the series has any x value, found once rather than per point.
|
||||
let any_x = s.x_values.iter().flatten().next().is_some();
|
||||
for i in 0..ncat {
|
||||
let Some(v) = s.values.get(i).copied().flatten() else { continue };
|
||||
let own = v;
|
||||
let v = if stacked {
|
||||
let base_v = acc.get(i).copied().unwrap_or(0.0);
|
||||
if let Some(a) = acc.get_mut(i) {
|
||||
@@ -942,6 +947,7 @@ fn draw_lines(ctx: &mut RenderContext, draw: &mut LineDrawing<'_, '_>) {
|
||||
err_marks.push((x, to_axis(sec, lo), to_axis(sec, hi), base * 0.4, s.error_bars.as_ref().is_some_and(|e| e.end_cap)));
|
||||
}
|
||||
pts.push(Point::new(x, to_axis(sec, v)));
|
||||
values.push(own);
|
||||
}
|
||||
if pts.is_empty() {
|
||||
continue;
|
||||
@@ -969,6 +975,22 @@ fn draw_lines(ctx: &mut RenderContext, draw: &mut LineDrawing<'_, '_>) {
|
||||
ctx.fill_path(&kurbo::Circle::new(*q, 3.5).to_path(0.1));
|
||||
}
|
||||
}
|
||||
// A line series that asks for value labels (`c:dLbls/c:showVal`) shows each point's value
|
||||
// just above it, as bars do theirs (#2066). Area series keep none (theirs sit inside the
|
||||
// area), and scatter and bubble series, which also come here, are left as they were.
|
||||
if matches!(kind, ChartType::Line | ChartType::LineMarkers | ChartType::StackedLine) && c.series_data_labels(s) {
|
||||
let gap = base * 0.3 + 3.5;
|
||||
for (q, v) in pts.iter().zip(&values) {
|
||||
label(
|
||||
ctx,
|
||||
rctx,
|
||||
m,
|
||||
&c.data_label(s, *v),
|
||||
Rect::new(q.x - 40.0, q.y - gap - base * 1.4, q.x + 40.0, q.y - gap),
|
||||
LabelStyle { size: base * 0.9, align: Align::Center, anchor: Anchor::Bottom, col: draw.text_color, bold: false },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,9 @@ mod tests_wild;
|
||||
#[cfg(test)]
|
||||
mod tests_effect_holes;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests_placed_group;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mt_tests {
|
||||
use super::*;
|
||||
|
||||
@@ -12,7 +12,10 @@ use crate::{SlideFields, shape_geometry, table};
|
||||
/// One shape's text as drawn on the slide.
|
||||
pub struct PlacedText {
|
||||
pub layout: TextLayout,
|
||||
/// Shape-local → slide points (text rotation included, flips not: see [`crate::text_transform`]).
|
||||
/// Text-local → slide points (text rotation included, flips not: see [`crate::text_transform`]).
|
||||
/// Text-local space is the shape's own space, except inside a group whose child coordinates
|
||||
/// scale the shape: there the text is set at the shape's size on the slide, as the renderer
|
||||
/// draws it, so font sizes and insets stay in points.
|
||||
pub transform: Affine,
|
||||
pub body: TextBody,
|
||||
}
|
||||
@@ -149,13 +152,15 @@ fn place(out: &mut Placed, rctx: &Ctx, fields: &SlideFields, s: &Shape, parent:
|
||||
ShapeKind::Chart(_) | ShapeKind::Ink { .. } => {}
|
||||
_ => {
|
||||
let Some(body) = s.text.as_ref().filter(|b| !b.is_empty()) else { return };
|
||||
let tr = shape_geometry(s, x.w, x.h).text_rect;
|
||||
place_text(out, rctx, fields, s.id, s, body, tr, m);
|
||||
// Placed space is slide points, so `m` is also the shape's transform relative to them.
|
||||
let (tw, th, tm) = text_space(m, m, depth, x.w, x.h);
|
||||
let tr = shape_geometry(s, tw, th).text_rect;
|
||||
place_text(out, rctx, fields, s.id, s, body, tr, tm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Lay out `body` in text rect `tr` of shape `s` (shape-local → slide `m`) and record it and its hyperlinks.
|
||||
/// Lay out `body` in text rect `tr` of shape `s` (text-local → slide `m`) and record it and its hyperlinks.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn place_text(out: &mut Placed, rctx: &Ctx, fields: &SlideFields, owner: ShapeId, s: &Shape, body: &TextBody, tr: Rect, m: Affine) {
|
||||
let layout = deckcraft_text::layout(rctx, s, body, &Opts { rect: tr, fields, prompt_color: None, no_shrink: false });
|
||||
@@ -188,6 +193,25 @@ fn place_text(out: &mut Placed, rctx: &Ctx, fields: &SlideFields, owner: ShapeId
|
||||
out.texts.push(PlacedText { layout, transform: m, body: placed });
|
||||
}
|
||||
|
||||
/// The size and transform a shape's text is set in. `rel` is the shape's transform relative to
|
||||
/// slide points and `m` the one its text is drawn under; `depth` is its group nesting. Inside a
|
||||
/// group whose child coordinates scale the shape, the text is set at the shape's size in slide
|
||||
/// points under `m` with that scale taken out, so insets and font sizes stay in points; otherwise
|
||||
/// in `w` × `h` under `m` itself.
|
||||
pub(crate) fn text_space(rel: Affine, m: Affine, depth: usize, w: f64, h: f64) -> (f64, f64, Affine) {
|
||||
let c = rel.as_coeffs();
|
||||
let (sx, sy) = (c[0].hypot(c[1]), c[2].hypot(c[3]));
|
||||
let ok = |k: f64| k.is_finite() && k > 1e-9;
|
||||
if depth == 0 || !ok(sx) || !ok(sy) || ((sx - 1.0).abs() < 1e-9 && (sy - 1.0).abs() < 1e-9) {
|
||||
return (w, h, m);
|
||||
}
|
||||
let (tw, th) = (w * sx, h * sy);
|
||||
if !tw.is_finite() || !th.is_finite() {
|
||||
return (w, h, m);
|
||||
}
|
||||
(tw, th, m * Affine::scale_non_uniform(1.0 / sx, 1.0 / sy))
|
||||
}
|
||||
|
||||
/// The hyperlink of the model run containing character `at` of paragraph `para`.
|
||||
fn run_link(body: &TextBody, para: usize, at: usize) -> Option<Hyperlink> {
|
||||
let p = body.paragraphs.get(para)?;
|
||||
|
||||
@@ -368,17 +368,7 @@ impl Renderer {
|
||||
/// insets and font sizes stay in points; otherwise `w`, `h` and `m` themselves.
|
||||
fn text_space(&self, m: Affine, depth: usize, w: f64, h: f64) -> (f64, f64, Affine) {
|
||||
let (_, rel) = self.line_space(m, depth);
|
||||
let c = rel.as_coeffs();
|
||||
let (sx, sy) = (c[0].hypot(c[1]), c[2].hypot(c[3]));
|
||||
let ok = |k: f64| k.is_finite() && k > 1e-9;
|
||||
if depth == 0 || !ok(sx) || !ok(sy) || ((sx - 1.0).abs() < 1e-9 && (sy - 1.0).abs() < 1e-9) {
|
||||
return (w, h, m);
|
||||
}
|
||||
let (tw, th) = (w * sx, h * sy);
|
||||
if !tw.is_finite() || !th.is_finite() {
|
||||
return (w, h, m);
|
||||
}
|
||||
(tw, th, m * Affine::scale_non_uniform(1.0 / sx, 1.0 / sy))
|
||||
crate::placed::text_space(rel, m, depth, w, h)
|
||||
}
|
||||
|
||||
/// A shape's geometry in its own `w` × `h` space, built at its size on the slide: inside a
|
||||
|
||||
@@ -37,18 +37,20 @@ pub fn needs_filters(pres: &Presentation, slide: &Slide) -> bool {
|
||||
any
|
||||
}
|
||||
|
||||
/// Does the shape's text have a shadow or glow (on a run, in its list style, or in the master's
|
||||
/// text styles it inherits)? Such text is blurred, which needs filters.
|
||||
/// Does the shape's text have a shadow or glow (on a run, in its paragraph's `defRPr`, in its list
|
||||
/// style, or in the master's or presentation's text styles it inherits)? Such text is blurred,
|
||||
/// which needs filters.
|
||||
fn text_has_effects(rctx: &Ctx, s: &Shape) -> bool {
|
||||
use deckcraft_model::text::{ListStyle, RunProps};
|
||||
let fx = |r: &RunProps| r.shadow.as_ref().is_some_and(|s| !s.inner) || r.glow.as_ref().is_some_and(|g| g.radius > 0.0);
|
||||
let styled = |l: &ListStyle| l.levels.iter().flatten().any(|lv| fx(&lv.run));
|
||||
let Some(t) = &s.text else { return false };
|
||||
t.paragraphs.iter().any(|p| p.runs.iter().any(|r| fx(&r.props)) || fx(&p.end_props))
|
||||
t.paragraphs.iter().any(|p| p.runs.iter().any(|r| fx(&r.props)) || fx(&p.end_props) || fx(&p.def_props))
|
||||
|| styled(&t.list_style)
|
||||
|| styled(&rctx.master.title_style)
|
||||
|| styled(&rctx.master.body_style)
|
||||
|| styled(&rctx.master.other_style)
|
||||
|| styled(&rctx.pres.default_text_style)
|
||||
}
|
||||
|
||||
/// Render slide `index` at `opts.scale` pixels per point. A panic inside the renderer becomes a
|
||||
|
||||
@@ -1239,6 +1239,39 @@ fn effect_text(set: impl Fn(&mut deckcraft_model::text::RunProps)) -> Presentati
|
||||
deck_with(vec![sh])
|
||||
}
|
||||
|
||||
/// Text whose glow comes only from its paragraph's `defRPr` needs the filters too: drawn on the
|
||||
/// worker threads it panicked (vello_cpu has no filters there) and the slide came out blank.
|
||||
#[test]
|
||||
fn a_paragraph_default_text_glow_needs_filters() {
|
||||
let mut sh = Shape { id: ShapeId(741), xfrm: Some(Xfrm::new(100.0, 100.0, 600.0, 300.0)), text_box: true, ..Default::default() };
|
||||
let mut t = TextBody::from_text("IIII");
|
||||
let p = &mut t.paragraphs[0];
|
||||
p.runs[0].props.size = Some(100.0);
|
||||
p.runs[0].props.fill = Some(deckcraft_model::style::Fill::solid(ColorRef::rgb(deckcraft_color::Rgba::rgb(0, 0, 0))));
|
||||
p.def_props.glow = Some(deckcraft_model::style::Glow { color: ColorRef::rgb(deckcraft_color::Rgba::rgb(0, 255, 0)), radius: 8.0 });
|
||||
sh.text = Some(t);
|
||||
assert_green_glow_drawn_with_threads(&deck_with(vec![sh]));
|
||||
}
|
||||
|
||||
/// Text whose glow comes only from the presentation's default text style (`p:defaultTextStyle`)
|
||||
/// needs the filters too, or the threaded render panics and the slide comes out blank.
|
||||
#[test]
|
||||
fn a_presentation_default_text_style_glow_needs_filters() {
|
||||
let mut deck = effect_text(|_| {});
|
||||
let level = deck.default_text_style.levels[0].as_mut().expect("the default text style sets level 1");
|
||||
level.run.glow = Some(deckcraft_model::style::Glow { color: ColorRef::rgb(deckcraft_color::Rgba::rgb(0, 255, 0)), radius: 8.0 });
|
||||
assert_green_glow_drawn_with_threads(&deck);
|
||||
}
|
||||
|
||||
/// Asserts that `deck`'s first slide needs filters and that, rendered with worker threads
|
||||
/// requested, its text shows a green glow halo rather than a blank slide.
|
||||
fn assert_green_glow_drawn_with_threads(deck: &Presentation) {
|
||||
assert!(needs_filters(deck, &deck.slides[0]));
|
||||
let img = render_slide(deck, 0, &RenderOpts { scale: 1.0, threads: 4, ..Default::default() });
|
||||
let halo = img.pixels.as_chunks::<4>().0.iter().filter(|p| p[1] > 150 && p[0] < 120 && p[2] < 120).count();
|
||||
assert!(halo > 300, "green halo pixels {halo}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_glow_and_shadow_are_drawn() {
|
||||
let count = |img: &Image, f: &dyn Fn(&[u8; 4]) -> bool| img.pixels.as_chunks::<4>().0.iter().filter(|px| f(px)).count();
|
||||
@@ -3205,6 +3238,117 @@ fn pie_data_labels_take_the_chart_text_colour_when_it_has_one() {
|
||||
assert!(count(&plain, &white) > count(&coloured, &white), "the labels were white before");
|
||||
}
|
||||
|
||||
/// #2066: a line series that asks for value labels (`c:dLbls/c:showVal`, chart-wide or its own)
|
||||
/// shows each point's value above it; with the chart's text red, the labels add red ink there.
|
||||
/// Area series still draw none (their labels belong inside the area, not on a point).
|
||||
#[test]
|
||||
fn line_chart_value_labels_are_drawn_above_their_points() {
|
||||
let draw = |kind: ChartType, labels: bool, own: bool| {
|
||||
let mut c = Chart::sample(kind);
|
||||
c.title = None;
|
||||
c.legend = None;
|
||||
c.text_color = Some(ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 0)));
|
||||
if own {
|
||||
c.series[0].data_labels = Some(labels);
|
||||
} else {
|
||||
c.data_labels = labels;
|
||||
}
|
||||
let sh = Shape { id: ShapeId(633), xfrm: Some(Xfrm::new(0.0, 0.0, 400.0, 300.0)), kind: ShapeKind::Chart(Box::new(c)), ..Default::default() };
|
||||
render_slide(&deck_with(vec![sh]), 0, &RenderOpts { scale: 1.0, ..Default::default() })
|
||||
};
|
||||
let red = |img: &Image| {
|
||||
(0..400u32)
|
||||
.flat_map(|x| (0..300u32).map(move |y| (x, y)))
|
||||
.filter(|(x, y)| {
|
||||
let p = img.pixel(*x, *y);
|
||||
p[0] > 200 && p[1] < 60 && p[2] < 60
|
||||
})
|
||||
.count()
|
||||
};
|
||||
for kind in [ChartType::Line, ChartType::LineMarkers] {
|
||||
let (off, on) = (red(&draw(kind, false, false)), red(&draw(kind, true, false)));
|
||||
assert!(on > off + 100, "{kind:?}: labels add red ink ({off} → {on})");
|
||||
let own = red(&draw(kind, true, true));
|
||||
assert!(own > off + 30, "{kind:?}: a series' own showVal shows its labels ({off} → {own})");
|
||||
}
|
||||
// Area series keep none, and scatter and bubble series (drawn by the same code) are unchanged.
|
||||
for kind in [ChartType::Area, ChartType::Scatter, ChartType::Bubble] {
|
||||
let (off, on) = (red(&draw(kind, false, false)), red(&draw(kind, true, false)));
|
||||
assert_eq!(on, off, "{kind:?}: no point labels");
|
||||
}
|
||||
}
|
||||
|
||||
/// The magenta pixels the labels add to a line chart of two series, only the second labelled,
|
||||
/// with the chart's text magenta (no series, gridline or axis line is): its axis labels are
|
||||
/// magenta too, so they are what the unlabelled chart has.
|
||||
fn line_label_ink(kind: ChartType, first: f64, second: f64) -> (Image, Vec<(u32, u32)>) {
|
||||
let off: std::collections::HashSet<_> = magenta_pixels(&line_label_render(kind, first, second, false)).into_iter().collect();
|
||||
let img = line_label_render(kind, first, second, true);
|
||||
let added = magenta_pixels(&img).into_iter().filter(|p| !off.contains(p)).collect();
|
||||
(img, added)
|
||||
}
|
||||
|
||||
fn line_label_render(kind: ChartType, first: f64, second: f64, labels: bool) -> Image {
|
||||
let mut c = Chart::sample(ChartType::Line);
|
||||
c.kind = kind;
|
||||
c.title = None;
|
||||
c.legend = None;
|
||||
c.series.truncate(2);
|
||||
c.series[0].values = vec![Some(first); 4];
|
||||
c.series[1].values = vec![Some(second); 4];
|
||||
c.series[1].data_labels = Some(labels);
|
||||
c.text_color = Some(ColorRef::rgb(deckcraft_color::Rgba::rgb(255, 0, 255)));
|
||||
let sh = Shape { id: ShapeId(634), xfrm: Some(Xfrm::new(0.0, 0.0, 400.0, 300.0)), kind: ShapeKind::Chart(Box::new(c)), ..Default::default() };
|
||||
render_slide(&deck_with(vec![sh]), 0, &RenderOpts { scale: 1.0, ..Default::default() })
|
||||
}
|
||||
|
||||
/// Magenta ink on white, its anti-aliased edges included.
|
||||
fn is_magenta(p: [u8; 4]) -> bool {
|
||||
p[0] > 200 && p[2] > 200 && p[1] < 200
|
||||
}
|
||||
|
||||
fn magenta_pixels(img: &Image) -> Vec<(u32, u32)> {
|
||||
(0..img.width).flat_map(|x| (0..img.height).map(move |y| (x, y))).filter(|(x, y)| is_magenta(img.pixel(*x, *y))).collect()
|
||||
}
|
||||
|
||||
/// #2066: in a stacked line chart a point's label is its own value, not the running total it is
|
||||
/// drawn at. The second series' 5s, stacked on 100s, are labels as wide as an unstacked series of
|
||||
/// 5s, and far narrower than one of 105s (the width: the pixel columns the label ink covers).
|
||||
#[test]
|
||||
fn a_stacked_line_labels_each_point_with_its_own_value() {
|
||||
let width = |kind, second| line_label_ink(kind, 100.0, second).1.iter().map(|(x, _)| *x).collect::<std::collections::HashSet<_>>().len();
|
||||
let (stacked, fives, totals) = (width(ChartType::StackedLine, 5.0), width(ChartType::Line, 5.0), width(ChartType::Line, 105.0));
|
||||
assert!(stacked > 0 && fives > 0, "labels are drawn ({stacked}, {fives})");
|
||||
assert!(stacked.abs_diff(fives) <= 4, "stacked 5s are labelled \"5\" ({stacked} columns vs {fives} for 5s)");
|
||||
assert!(stacked * 2 < totals, "not with the total \"105\" ({stacked} columns vs {totals} for 105s)");
|
||||
}
|
||||
|
||||
/// #2066: a line label sits just above its point: all its ink is above the series' line, and
|
||||
/// its lowest row is close to it.
|
||||
#[test]
|
||||
fn a_line_label_sits_just_above_its_point() {
|
||||
let (img, ink) = line_label_ink(ChartType::Line, 20.0, 50.0);
|
||||
assert!(!ink.is_empty(), "labels are drawn");
|
||||
let cols: std::collections::HashSet<u32> = ink.iter().map(|(x, _)| *x).collect();
|
||||
let (first, last) = (cols.iter().min().copied().unwrap(), cols.iter().max().copied().unwrap());
|
||||
// The labelled series' flat line at 50: the topmost coloured pixel in the plot's columns
|
||||
// between the labels (the other line is lower, at 20; the axis labels lie outside them).
|
||||
let line_top = (first..last)
|
||||
.filter(|x| !cols.iter().any(|c| c.abs_diff(*x) < 4))
|
||||
.filter_map(|x| {
|
||||
(0..img.height).find(|y| {
|
||||
let p = img.pixel(x, *y);
|
||||
let (hi, lo) = (p[0].max(p[1]).max(p[2]), p[0].min(p[1]).min(p[2]));
|
||||
hi - lo > 80 && !is_magenta(p)
|
||||
})
|
||||
})
|
||||
.min()
|
||||
.unwrap();
|
||||
let lowest = ink.iter().map(|(_, y)| *y).max().unwrap();
|
||||
assert!(lowest < line_top, "the labels are above the line (lowest ink row {lowest}, line at {line_top})");
|
||||
assert!(line_top - lowest < 20, "and just above it (lowest ink row {lowest}, line at {line_top})");
|
||||
}
|
||||
|
||||
/// #1165: an ellipse sized at the EMU limit, crossing the slide, made vello's flattener allocate a
|
||||
/// buffer from its on-screen length and abort. It is skipped; the rest of the slide still draws.
|
||||
#[test]
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//! `place_slide` sets the text of a shape inside a group whose child coordinates scale it the way
|
||||
//! the slide draws it: at the shape's size on the slide, with font sizes and insets in points.
|
||||
|
||||
use super::{Fill, Point, place_slide};
|
||||
use deckcraft_model::style::ColorRef;
|
||||
use deckcraft_model::text::TextBody;
|
||||
use deckcraft_model::{Presentation, Shape, ShapeId, ShapeKind, Xfrm};
|
||||
|
||||
/// A deck whose slide shows a shape at (100, 100), 400 × 200 points, with 24 pt black text: on its
|
||||
/// own, or inside a group whose child space is `scale` times smaller than the group.
|
||||
fn deck(scale: Option<f64>) -> Presentation {
|
||||
let mut body = TextBody::from_text("Placed where it is drawn");
|
||||
body.paragraphs[0].runs[0].props.size = Some(24.0);
|
||||
body.paragraphs[0].runs[0].props.fill = Some(Fill::solid(ColorRef::rgb(deckcraft_color::Rgba::BLACK)));
|
||||
let shape = match scale {
|
||||
None => Shape { id: ShapeId(701), xfrm: Some(Xfrm::new(100.0, 100.0, 400.0, 200.0)), text: Some(body), ..Default::default() },
|
||||
Some(k) => {
|
||||
let child = Shape { id: ShapeId(701), xfrm: Some(Xfrm::new(0.0, 0.0, 400.0 / k, 200.0 / k)), text: Some(body), ..Default::default() };
|
||||
Shape {
|
||||
id: ShapeId(700),
|
||||
xfrm: Some(Xfrm::new(100.0, 100.0, 400.0, 200.0)),
|
||||
kind: ShapeKind::Group { children: vec![child], child: Xfrm::new(0.0, 0.0, 400.0 / k, 200.0 / k) },
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
};
|
||||
let mut p = Presentation::default();
|
||||
std::sync::Arc::make_mut(&mut p.slides[0]).shapes = vec![shape];
|
||||
p
|
||||
}
|
||||
|
||||
/// Each placed glyph: its id, its origin on the slide and its run's drawn size (the font size
|
||||
/// times the scale of the text's transform).
|
||||
fn glyphs_on_slide(p: &Presentation) -> Vec<(u32, Point, f64)> {
|
||||
let placed = place_slide(p, 0);
|
||||
let mut out = vec![];
|
||||
for t in &placed.texts {
|
||||
let k = t.transform.determinant().abs().sqrt();
|
||||
for g in &t.layout.runs {
|
||||
for &(gid, x, y) in &g.glyphs {
|
||||
out.push((gid, t.transform * Point::new(x, y), g.size * k));
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_in_a_scaled_group_is_placed_as_drawn() {
|
||||
let plain = glyphs_on_slide(&deck(None));
|
||||
assert!(!plain.is_empty());
|
||||
assert!(plain.iter().all(|g| (g.2 - 24.0).abs() < 1e-6), "{plain:?}");
|
||||
for scale in [1.0, 1600.0, 4.0, 0.25] {
|
||||
let grouped = glyphs_on_slide(&deck(Some(scale)));
|
||||
assert_eq!(grouped.len(), plain.len(), "scale {scale}");
|
||||
for (a, b) in grouped.iter().zip(&plain) {
|
||||
assert_eq!(a.0, b.0, "scale {scale}");
|
||||
assert!((a.1 - b.1).hypot() < 0.01, "scale {scale}: glyph at {:?}, on its own at {:?}", a.1, b.1);
|
||||
assert!((a.2 - b.2).abs() < 0.01, "scale {scale}: drawn at {} pt, on its own at {} pt", a.2, b.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1992,3 +1992,34 @@ fn signed_insets_are_preserved_when_they_fit() {
|
||||
assert_eq!(l.lines.len(), 1);
|
||||
assert_eq!(l.inner.x0, -10.0);
|
||||
}
|
||||
|
||||
/// Each run is shaped in its own language (Review › Language), so a font's forms for that language
|
||||
/// (OpenType `locl`) are drawn: the Serbian б, not the Russian one, in a Serbian run beside a
|
||||
/// Russian run of the same word.
|
||||
#[test]
|
||||
fn serbian_runs_draw_the_fonts_serbian_forms() {
|
||||
let b = |f: &FontFace, lang: &str| {
|
||||
let params = deckcraft_fonts::ShapeParams { language: Some(lang), ..Default::default() };
|
||||
deckcraft_fonts::shape_range(f, "б", 0.."б".len(), ¶ms, |c| c).first().map(|g| g.gid)
|
||||
};
|
||||
let serbian_form = |f: &FontFace| b(f, "sr-Cyrl-RS") != b(f, "ru-RU");
|
||||
let Some(family) = first_family(&["DejaVu Sans", "DejaVu Serif", "Source Sans 3", "Source Serif 4", "Noto Sans", "Noto Serif"], serbian_form)
|
||||
else {
|
||||
eprintln!("skipped: no font with a Serbian б");
|
||||
return;
|
||||
};
|
||||
let run = |text: &str, lang: &str| {
|
||||
let mut r = Run::new(text);
|
||||
r.props.lang = Some(lang.into());
|
||||
r.props.font = Some(family.clone());
|
||||
r
|
||||
};
|
||||
let (p, sh) = bidi_setup(vec![run("грб ", "sr-Cyrl-RS"), run("грб", "ru-RU")], 2000.0, false, Align::Left);
|
||||
let l = lay(&p, &sh, 2000.0, 300.0);
|
||||
// Glyph of each paragraph character.
|
||||
let at = |i: usize| l.runs.iter().find_map(|r| r.cells.iter().position(|&(k, _)| k == i).and_then(|g| r.glyphs.get(g)).map(|g| g.0));
|
||||
// г р б, space, г р б: each б is the one its language gives.
|
||||
let face = FontDb::global().face(&family, "Regular");
|
||||
assert_eq!(at(2), b(&face, "sr-Cyrl-RS"), "{family}: the Serbian б");
|
||||
assert_eq!(at(6), b(&face, "ru-RU"), "{family}: the Russian б");
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ impl SlideApp {
|
||||
format!("{name}.{ext}")
|
||||
}
|
||||
|
||||
/// Exports the active presentation as `fmt` (`pdf`, `png`, `pngAll`, `jpeg`, `pptx`,
|
||||
/// Exports the active presentation as `fmt` (`pdf`, `png`, `pngAll`, `jpeg`, `jpegAll`, `pptx`,
|
||||
/// `deckcraft`, `outline`) through `file.export`: the save picker on the desktop, a download
|
||||
/// on the web. `extra` adds `file.export` params (the PDF's layout, slides…). The
|
||||
/// presentation keeps its own file. Returns whether a file was written or handed over.
|
||||
@@ -193,6 +193,7 @@ impl SlideApp {
|
||||
"png" => ("png", "png", false),
|
||||
"pngAll" => ("png", "png", true),
|
||||
"jpeg" | "jpg" => ("jpg", "jpeg", false),
|
||||
"jpegAll" => ("jpg", "jpeg", true),
|
||||
"pptx" => ("pptx", "pptx", false),
|
||||
"outline" | "txt" => ("txt", "outline", false),
|
||||
"rtf" => ("rtf", "rtf", false),
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::files::task;
|
||||
use super::{Backstage, Icon, Outcome, Page, RichText, Sense, SlideApp, Tokens, Ui, Value, dim, heading, json, theme, vec2};
|
||||
|
||||
/// Save As and Change File Type: (id for [`SlideApp::export_as`], label, detail).
|
||||
pub const SAVE_TYPES: [(&str, &str, &str); 7] = [
|
||||
pub const SAVE_TYPES: [(&str, &str, &str); 9] = [
|
||||
("pptx", "PowerPoint Presentation (*.pptx)", "Opens in PowerPoint and other presentation apps"),
|
||||
("deckcraft", "DeckCraft Presentation (*.deckcraft)", "DeckCraft's own format: everything is kept"),
|
||||
("pdf", "PDF (*.pdf)", "A fixed copy that keeps its layout on any device"),
|
||||
@@ -10,6 +10,8 @@ pub const SAVE_TYPES: [(&str, &str, &str); 7] = [
|
||||
("rtf", "Outline/RTF (*.rtf)", "The slide titles and bullet text for word processors"),
|
||||
("png", "PNG Picture (*.png)", "The current slide as a picture"),
|
||||
("jpeg", "JPEG Picture (*.jpg)", "The current slide as a compressed picture"),
|
||||
("pngAll", "PNG Pictures, all slides (*.png)", "Every slide as its own picture"),
|
||||
("jpegAll", "JPEG Pictures, all slides (*.jpg)", "Every slide as its own compressed picture"),
|
||||
];
|
||||
|
||||
/// Info page properties: (`file.properties` key, label, hint).
|
||||
@@ -156,6 +158,8 @@ pub(super) fn save_as(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage, out:
|
||||
ui.horizontal(|ui| {
|
||||
craft_ui::ComboBox::from_id_salt("backstage_save_type")
|
||||
.width(340.0)
|
||||
// Every type in view: at the default height the last ones were behind a scroll.
|
||||
.height(f32::INFINITY)
|
||||
.selected_text(current)
|
||||
.show_ui(ui, |ui| {
|
||||
for (id, label, _) in SAVE_TYPES {
|
||||
|
||||
@@ -357,7 +357,7 @@ pub(super) fn export(app: &mut SlideApp, ui: &mut Ui, bs: &mut Backstage) {
|
||||
}
|
||||
}
|
||||
ui.add_space(12.0);
|
||||
let png = bs.file_type == "png";
|
||||
let png = matches!(bs.file_type, "png" | "pngAll");
|
||||
if png {
|
||||
ui.checkbox(&mut bs.png_transparent, "Transparent background")
|
||||
.on_hover_text("Leave the slide background out: only what is on the slide is drawn");
|
||||
|
||||
@@ -349,6 +349,64 @@ fn change_file_type_png_can_leave_the_background_transparent() {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// Export › Change File Type exports every slide as its own picture, PNG or JPEG (#2019).
|
||||
#[test]
|
||||
fn change_file_type_exports_all_slides_as_pictures() {
|
||||
let dir = temp_dir("all-slides");
|
||||
let (services, asked) = saving_into(&dir);
|
||||
let mut h = harness(SlideApp::new(Session::with_new(), services));
|
||||
h.state_mut().run("slide.new", json!({})).unwrap();
|
||||
h.state_mut().run("slide.new", json!({})).unwrap();
|
||||
let title = h.state().session.active().unwrap().title();
|
||||
h.state_mut().run("app.backstage", json!({"page": "export"})).unwrap();
|
||||
h.run_steps(3);
|
||||
click_on_page(&h, "Change File Type");
|
||||
h.run_steps(3);
|
||||
click_on_page(&h, "JPEG Pictures, all slides (*.jpg)");
|
||||
h.run_steps(2);
|
||||
assert!(h.query_by_label("Transparent background").is_none(), "JPEG has no transparency");
|
||||
click_on_page(&h, "Save As");
|
||||
h.run_steps(3);
|
||||
for k in 1..=3 {
|
||||
let jpg = std::fs::read(dir.join(format!("{title}{k}.jpg"))).unwrap();
|
||||
assert!(jpg.starts_with(&[0xFF, 0xD8]), "slide {k} is a JPEG");
|
||||
}
|
||||
assert!(!dir.join(format!("{title}4.jpg")).exists(), "one picture per slide");
|
||||
|
||||
h.state_mut().run("app.backstage", json!({"page": "export"})).unwrap();
|
||||
h.run_steps(3);
|
||||
click_on_page(&h, "Change File Type");
|
||||
h.run_steps(3);
|
||||
click_on_page(&h, "PNG Pictures, all slides (*.png)");
|
||||
h.run_steps(2);
|
||||
h.get_by_label("Transparent background").click();
|
||||
h.run_steps(2);
|
||||
click_on_page(&h, "Save As");
|
||||
h.run_steps(3);
|
||||
for k in 1..=3 {
|
||||
let png = std::fs::read(dir.join(format!("{title}{k}.png"))).unwrap();
|
||||
let img = deckcraft_render::decode_image(&png).unwrap();
|
||||
assert_eq!(img.get_pixel(2, 2).0[3], 0, "slide {k} leaves the background out");
|
||||
}
|
||||
assert_eq!(*asked.borrow(), vec![format!("{title}.jpg"), format!("{title}.png")]);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// Save As shows every type in its open list: the last one is picked by a click, not hidden
|
||||
/// below the list's default height (#2019).
|
||||
#[test]
|
||||
fn save_as_type_list_shows_every_type() {
|
||||
let mut h = harness(new_app());
|
||||
h.state_mut().run("app.backstage", json!({"page": "saveAs"})).unwrap();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Save as type").click();
|
||||
h.run_steps(3);
|
||||
let (last, label, _) = crate::backstage::SAVE_TYPES[crate::backstage::SAVE_TYPES.len() - 1];
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(3);
|
||||
assert_eq!(h.state().backstage.as_ref().map(|b| b.file_type), Some(last));
|
||||
}
|
||||
|
||||
/// Close closes a saved presentation at once and asks about unsaved changes first.
|
||||
#[test]
|
||||
fn close_closes_and_asks_about_unsaved_changes() {
|
||||
|
||||
@@ -152,6 +152,11 @@ pub fn show(app: &mut SlideApp, ui: &mut Ui) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let avail = ui.available_rect_before_wrap();
|
||||
app.canvas_rect = Some(avail);
|
||||
// The notes pane and the panes beside the canvas are editor chrome over it: nothing the
|
||||
// canvas paints or hit-tests (the media bar hangs 6 pt below its clip, handles stick out of a
|
||||
// shape, scroll bars) may reach into them. The parent's clip still covers the whole central
|
||||
// area, so clip this `Ui` to the rect the canvas was given (#1922).
|
||||
ui.set_clip_rect(avail.intersect(ui.clip_rect()));
|
||||
let Some(st) = app.session.active() else { return };
|
||||
// The leftover fraction of a wheel line belongs to one presentation. Drop it whenever another
|
||||
// one is drawn here, hovered or not, so switching away and back starts from zero.
|
||||
|
||||
@@ -230,6 +230,8 @@ pub const LANGS: &[(&str, &str)] = &[
|
||||
("Українська", "uk-UA"),
|
||||
("Русский", "ru-RU"),
|
||||
("Беларуская", "be-BY"),
|
||||
("Српски (ћирилица)", "sr-Cyrl-RS"),
|
||||
("Srpski (latinica)", "sr-Latn-RS"),
|
||||
("Türkçe", "tr-TR"),
|
||||
("Ελληνικά", "el-GR"),
|
||||
("日本語", "ja-JP"),
|
||||
|
||||
@@ -707,6 +707,9 @@ fn dlg_rename_section(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
ok || cancel
|
||||
}
|
||||
|
||||
/// Export…: the format (PDF, PNG or JPEG of the current slide or of every slide, PowerPoint,
|
||||
/// outline, animated GIF, RTF) and its options; Export hands them to [`SlideApp::export_as`].
|
||||
/// Returns true when the dialog should close.
|
||||
fn dlg_export(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
ui.label("Export the presentation as:");
|
||||
let fmt = d.get("fmt", "pdf");
|
||||
@@ -715,6 +718,7 @@ fn dlg_export(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
("PNG images (current slide)", "png"),
|
||||
("PNG images (all slides)", "pngAll"),
|
||||
("JPEG image (current slide)", "jpeg"),
|
||||
("JPEG images (all slides)", "jpegAll"),
|
||||
("PowerPoint Presentation (.pptx)", "pptx"),
|
||||
("Outline (.txt)", "outline"),
|
||||
("Animated GIF (.gif)", "gif"),
|
||||
@@ -1351,8 +1355,14 @@ fn dlg_preferences(app: &mut SlideApp, ui: &mut Ui, d: &mut Dialog) -> bool {
|
||||
// on release, and at once from the keyboard.
|
||||
let pending = d.fields.get("uiScale").and_then(|v| v.parse::<f32>().ok());
|
||||
let mut scale = pending.unwrap_or(app.ui.ui_scale);
|
||||
let r = ui.add(egui::Slider::new(&mut scale, 0.75..=1.75));
|
||||
// No visible label here (the row is laid out to fit); the accessible name only.
|
||||
// Labelled like the Measurement units row below it. The egui 0.37 migration (#1350) dropped
|
||||
// the slider's own text and kept only its accessible name, which left a bare "1.00".
|
||||
let r = ui
|
||||
.horizontal(|ui| {
|
||||
ui.label("Interface size:");
|
||||
ui.add(egui::Slider::new(&mut scale, 0.75..=1.75))
|
||||
})
|
||||
.inner;
|
||||
let enabled = r.enabled();
|
||||
r.widget_info(|| egui::WidgetInfo::slider(enabled, f64::from(scale), "Interface size"));
|
||||
if r.is_pointer_button_down_on() {
|
||||
|
||||
@@ -39,6 +39,18 @@ fn dark(app: &SlideApp) -> bool {
|
||||
app.ui.brightness == Brightness::Dark
|
||||
}
|
||||
|
||||
/// The interface size slider has a visible label, not just a bare "1.00" beside it.
|
||||
#[test]
|
||||
fn the_interface_size_slider_is_labelled_on_screen() {
|
||||
let mut h = harness();
|
||||
open_options(&mut h);
|
||||
let label = h.query_by_label("Interface size:").expect("the slider's label is shown");
|
||||
let slider = interface_size(&h);
|
||||
let (label, slider) = (label.rect(), slider.rect());
|
||||
assert!(label.max.x <= slider.min.x, "the label sits before the slider: {label:?}, {slider:?}");
|
||||
assert!(label.center().y > slider.min.y && label.center().y < slider.max.y, "on the same row: {label:?}, {slider:?}");
|
||||
}
|
||||
|
||||
/// A checkbox applies as it is toggled and Cancel puts the old value back.
|
||||
#[test]
|
||||
fn options_cancel_undoes_the_changes() {
|
||||
|
||||
@@ -28,7 +28,7 @@ fn header_footer_apply_keeps_an_existing_date_format() {
|
||||
use crate::SlideApp;
|
||||
let mut session = deckcraft_engine::Session::with_new();
|
||||
session.execute("design.headerFooter", &json!({"date": true, "dateText": "", "dateFormat": "datetime4", "all": true})).unwrap();
|
||||
// A file whose document-level format is unset, as an imported deck's is.
|
||||
// A file whose document-level format is unset, as an imported deck's is when its date field is not one of the thirteen kinds.
|
||||
Arc::make_mut(&mut session.doc_mut().unwrap().doc).header_footer.date_format = String::new();
|
||||
let date_fields = |app: &SlideApp| -> Vec<String> {
|
||||
app.session
|
||||
|
||||
@@ -70,3 +70,59 @@ fn play_on_the_editor_media_bar_plays_the_selected_clip() {
|
||||
click(&mut h, bar + vec2(w - 30.0, 13.0));
|
||||
assert_eq!(h.state().session.active().unwrap().selection.shapes, vec![id]);
|
||||
}
|
||||
|
||||
/// #1922: the bar hangs 6 pt under the clip, so a clip at the bottom edge of the slide put it
|
||||
/// inside the speaker-notes pane, painted over the notes text. The canvas is clipped to its own
|
||||
/// rect: nothing it paints reaches the notes pane, and a click there goes to the notes field.
|
||||
#[test]
|
||||
fn the_media_bar_never_paints_or_clicks_into_the_notes_pane() {
|
||||
use egui::accesskit::Role;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
let mut s = Session::with_new();
|
||||
s.execute("slide.new", &json!({"layout": "blank"})).unwrap();
|
||||
let r = s.execute("insert.audio", &json!({"name": "tone.wav", "data": deckcraft_engine::cmd::base64_encode(&wav(2.0))})).unwrap();
|
||||
let id = ShapeId(r["id"].as_u64().unwrap() as u32);
|
||||
// Dragged across the bottom edge of the slide, onto the pasteboard.
|
||||
let h_slide = s.doc().unwrap().doc.slide_size.height;
|
||||
s.execute("shape.setBounds", &json!({"ids": [id.0], "x": 300.0, "y": h_slide - 10.0, "w": 120.0, "h": 60.0})).unwrap();
|
||||
let mut app = SlideApp::new(s, Services::default());
|
||||
app.ui.notes = true;
|
||||
app.ui.notes_height = 140.0;
|
||||
let mut h = Harness::builder().with_size(vec2(1400.0, 900.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut SlideApp| {
|
||||
app.logic(ui.ctx());
|
||||
app.ui(ui);
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(3);
|
||||
let notes = h.query_all_by_role(Role::MultilineTextInput).next().map(|n| n.rect()).expect("the notes field");
|
||||
let canvas = h.state().canvas_rect.unwrap();
|
||||
assert!(canvas.max.y <= notes.min.y + 1.0, "the notes pane sits under the canvas: {canvas:?} / {notes:?}");
|
||||
let d = h.state().session.active().unwrap();
|
||||
let x = d.doc.slides[d.selection.slide].shape(id).unwrap().xfrm.unwrap();
|
||||
let (slide, k) = (h.state().slide_rect.unwrap(), h.state().canvas_scale);
|
||||
let bottom = slide.min.y + (x.y + x.h) as f32 * k;
|
||||
let bar_y = bottom + 6.0 + 13.0;
|
||||
assert!(bar_y > notes.min.y, "the bar's row ({bar_y}) would fall inside the notes pane (top {})", notes.min.y);
|
||||
|
||||
// The bar's own background (the only dark rounded rect the canvas paints there) has no
|
||||
// visible area below the canvas edge: whatever the canvas paints is clipped to the canvas.
|
||||
let bar_fill = egui::Color32::from_rgba_unmultiplied(28, 28, 32, 230);
|
||||
let bars: Vec<egui::Rect> = h
|
||||
.output()
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|cs| match &cs.shape {
|
||||
egui::Shape::Rect(r) if r.fill == bar_fill => Some(r.rect.intersect(cs.clip_rect)),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert!(!bars.is_empty(), "the bar is still laid out for the selected clip");
|
||||
assert!(bars.iter().all(|v| !v.is_positive() || v.max.y <= canvas.max.y + 0.5), "the bar is painted into the notes pane: {bars:?}");
|
||||
|
||||
// A click where the bar would be lands in the notes field, not on the bar.
|
||||
click(&mut h, pos2(slide.min.x + (x.x + x.w / 2.0) as f32 * k, bar_y));
|
||||
assert!(h.state().media.status(id).is_none(), "Play was not hit through the notes pane");
|
||||
assert!(h.ctx.memory(|m| m.focused()).is_some(), "the notes field took the click");
|
||||
}
|
||||
|
||||
@@ -88,6 +88,27 @@ fn web_png_export_can_leave_the_background_transparent() {
|
||||
assert_eq!(corner_alpha(&got[2].1), 255, "JPEG has no transparency");
|
||||
}
|
||||
|
||||
/// Every type File › Save As and Export › Change File Type list is one `export_as` writes:
|
||||
/// a listed type it doesn't know would only say "can't export" (#2019).
|
||||
#[test]
|
||||
fn every_listed_save_type_exports() {
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
let got: Rc<RefCell<Vec<String>>> = Rc::default();
|
||||
let log = got.clone();
|
||||
let services = Services { download: Some(Box::new(move |name: &str, _: &[u8]| log.borrow_mut().push(name.to_string()))), ..Default::default() };
|
||||
let mut app = SlideApp::new(Session::with_new(), services);
|
||||
app.session.execute("slide.new", &json!({})).unwrap();
|
||||
for (id, _, _) in crate::backstage::SAVE_TYPES {
|
||||
assert!(app.export_as(id, json!({})), "{id} exports");
|
||||
}
|
||||
let title = app.session.active().unwrap().title();
|
||||
let got = got.borrow();
|
||||
for name in [format!("{title}1.jpg"), format!("{title}2.jpg"), format!("{title}1.png"), format!("{title}2.png")] {
|
||||
assert!(got.contains(&name), "{name} downloaded, got {got:?}");
|
||||
}
|
||||
}
|
||||
|
||||
fn title_text(app: &SlideApp) -> String {
|
||||
let d = app.session.active().unwrap();
|
||||
let sh = &d.doc.slides[0].shapes[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# File-format parity with PowerPoint
|
||||
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-07 · **Change:** trivial (a slide whose relationship is missing is reported in `lostSlides`; previous: minor (cell anchorCtr, vertOverflow/horzOverflow, compatLnSpc, normalizeH, thaiDist, table rtl, run altLang and reflection transforms round-trip; Reuse Slides brings referenced custom table styles; previous: minor (native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: seven owned PPTX corpus files, embedded fonts, EMF/WMF clip regions, threaded comments (#70), chart trendlines and workbooks (#335), SmartArt written as a diagram, tags and custom XML kept, picture export DPI; duplicated rows and headers folded; previous: trivial, lines in scaled groups, #233))) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-11 · **Change:** minor (empty notes slides are preserved on save and reopen, #2025; previous: trivial, a slide whose relationship is missing is reported in `lostSlides`; previous: minor (cell anchorCtr, vertOverflow/horzOverflow, compatLnSpc, normalizeH, thaiDist, table rtl, run altLang and reflection transforms round-trip; Reuse Slides brings referenced custom table styles; previous: minor (native chart payloads stored in bounded ZIP members; previous: major, community PR wave 2026-10-14: seven owned PPTX corpus files, embedded fonts, EMF/WMF clip regions, threaded comments (#70), chart trendlines and workbooks (#335), SmartArt written as a diagram, tags and custom XML kept, picture export DPI; duplicated rows and headers folded; previous: trivial, lines in scaled groups, #233))) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
|
||||
Every format PowerPoint reads or writes, DeckCraft's support, fidelity and how it is tested.
|
||||
Gaps are itemized in [gaps.md](gaps.md#file-formats). Dimension score: **~58% ready**
|
||||
@@ -77,7 +77,7 @@ the round trip even though DeckCraft doesn't model it.
|
||||
| Presentation, slide size, sections (p14), custom shows | yes | yes | |
|
||||
| Slide masters, layouts, placeholders and inheritance | yes | yes | |
|
||||
| Themes: colour, font (Latin/EA/CS), effect schemes, background styles | yes | yes | Unknown theme parts kept |
|
||||
| Notes slides and notes master | yes | yes | Header, footer, date and slide-number text on the notes master is kept. Edited in View ▸ Notes Master. Notes keep their run and paragraph formatting (bold, italic, underline, size, levels, indents, bullets), shown and kept when edited in the notes pane and Notes Page (`crates/pptx/tests/it/notes.rs`). PDF notes pages print them as plain text; levels and bullets inherited from a custom notes master aren't shown |
|
||||
| Notes slides and notes master | yes | yes | Header, footer, date and slide-number text on the notes master is kept. Edited in View ▸ Notes Master. Notes keep their run and paragraph formatting (bold, italic, underline, size, levels, indents, bullets), shown and kept when edited in the notes pane and Notes Page (`crates/pptx/tests/it/notes.rs`). Empty notes slides are preserved on save and reopen (#2025). PDF notes pages print them as plain text; levels and bullets inherited from a custom notes master aren't shown |
|
||||
| Handout master | yes | yes | Header, footer, date and slide-number text is kept. Edited in View ▸ Handout Master |
|
||||
| Shapes: preset geometry (~180 presets), custom geometry, groups, connectors | yes | yes | Presets re-derived in `crates/geom/src/preset.rs` (and `preset/extra.rs`). Outlines, dashes, arrowheads and ink inside a group, and text, keep their size in points whatever the group's child-coordinate scale (#233). |
|
||||
| Fills: solid, gradient, picture (stretch/tile/crop), pattern, group | yes | yes | |
|
||||
@@ -92,7 +92,7 @@ the round trip even though DeckCraft doesn't model it.
|
||||
| Charts (`cx:` chartex: waterfall, funnel, treemap, sunburst, histogram, Pareto, box) | yes | yes | Unchanged parts kept, with their embedded workbook (#335); edited and new ones written from the model with a plain-chart fallback. Treemap and sunburst hierarchy levels kept; region maps kept, drawn as tiles (no map geometry) |
|
||||
| SmartArt (`dgm`) | the drawing part as a group (text laid out on its `dsp:txXfrm` rectangle), and the outline from the data model (Text Pane) | as a diagram: data model from the outline; layout, quick style and colour parts (the file's own kept until the layout is switched); the group as the cached drawing | DeckCraft's layout definitions are simple; a diagram without a cached drawing isn't drawn. SmartArt kept only as XML, without its relationship parts, still loses the drawing and data parts (#203) |
|
||||
| Equations (OMML, `a14:m`) | no | no | PR #55 open |
|
||||
| Audio / video (`p14:media`, trim, fades, bookmarks) | yes | partly | Playback options lost on save (#74) |
|
||||
| Audio / video (`p14:media`, trim, fades, bookmarks, playback options) | yes | yes | Volume, mute, autoplay, loop, rewind, play across slides, hide while not playing and full screen round-trip (`media_timing.rs`) |
|
||||
| Ink (`contentPart`) | yes | as a group of freeform lines | PowerPoint sees shapes, not ink |
|
||||
| Transitions incl. p14/p15 (Vortex, Morph…) | all 48 | all 48 | `every_transition_kind_round_trips` |
|
||||
| Animations: timing tree, build paragraphs, triggers, motion paths | yes (flattened to the Animation Pane list) | yes (rebuilt) | `every_animation_effect_survives`; repeat, triggers, bounce end and rewind kept |
|
||||
@@ -122,6 +122,7 @@ the round trip even though DeckCraft doesn't model it.
|
||||
| 2026-11-07 | trivial | A slide-list entry whose relationship is missing is reported in `lostSlides` like an unreadable slide part, so the deck opens as a repaired copy; slide lists over 10,000 entries are refused with an import-limit error rather than silently truncated (#1910) |
|
||||
| 2026-11-02 | minor | Optional table RTL direction is read and written as `a:tblPr/@rtl`; native and two PPTX saves preserve true, false and absent values with distinguishable column text |
|
||||
| 2026-11-02 | minor | Text runs preserve alternate-language metadata in native and PPTX round trips |
|
||||
| 2026-11-11 | minor | Empty notes slides retain their notesSlide part and relationship on save and reopen (#2025) |
|
||||
| 2026-11-03 | trivial | Reuse Slides transfers referenced custom table styles from native and PPTX sources; grouped tables, undo, native save/reopen and style-id conflicts are covered |
|
||||
| 2026-10-18 | minor | Native chart payloads use referenced ZIP members and share media byte/item limits; old inline sidecars remain readable. Synthetic tests cover multi-megabyte layout, all shape owners, shared budgets, missing/corrupt members and invalid references. Scores and milestone scope unchanged |
|
||||
| 2026-11-02 | trivial | Reflection start position, affine scale/skew, direction and fade, alignment and rotation attributes survive native and PPTX saves; rendering remains partial |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Localization parity with PowerPoint
|
||||
|
||||
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-24 · **Change:** minor (opt-in native LXGW WenKai Lite fallback and interface CJK tests; local implementation only, managed validation pending; previous: minor, IME composition underlined in table cells; previous: minor, IME composition and CJK interface text, #101; previous: major, created) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-31 · **Change:** minor (Review › Language offers Serbian in Cyrillic and Latin, each with its own dictionary; previous: minor, opt-in native LXGW WenKai Lite fallback and interface CJK tests; local implementation only, managed validation pending; previous: minor, IME composition underlined in table cells; previous: minor, IME composition and CJK interface text, #101; previous: major, created) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
|
||||
DeckCraft's interface is English only today: strings are literals in the UI and engine code, with
|
||||
no catalog and no language switch. Requests: #15 (follow the system language), #30 and PR #34
|
||||
@@ -51,15 +51,23 @@ the next re-measure.
|
||||
## Proofing languages
|
||||
|
||||
PowerPoint checks spelling in dozens of languages and lets each run carry a proofing language.
|
||||
DeckCraft keeps `a:rPr/@lang` on round trip but its spelling check is a small English list of
|
||||
common misspellings (`crates/engine/src/cmd/review.rs`); see [gaps.md](gaps.md#proofing-spelling-thesaurus-autocorrect).
|
||||
DeckCraft keeps `a:rPr/@lang` on round trip and checks each run in its own language against the
|
||||
Hunspell dictionaries installed on the system (`crates/engine/src/spell.rs`), falling back to a
|
||||
built-in list of common English misspellings when there is none (`review.spelling`); see
|
||||
[gaps.md](gaps.md#proofing-spelling-thesaurus-autocorrect).
|
||||
Review › Language sets the proofing language of the selected text or, with *Whole presentation*,
|
||||
of every text in the file and the default for new text (`format.languageAll`).
|
||||
of every text in the file and the default for new text (`format.languageAll`). Each run is shaped
|
||||
in its language, so fonts draw their forms for it (OpenType `locl`: the Serbian б, г, д, п, т).
|
||||
Serbian is offered in both scripts (`sr-Cyrl-RS`, `sr-Latn-RS`). The run's language tag picks the
|
||||
dictionary, and only one in the script the tag names: LibreOffice's `sr` and `sr-Latn`, Hunspell's
|
||||
`sr_RS` and `sr_Latn_RS`, Fedora's `sr_RS@latin`, and the Serbo-Croatian `sh_RS`/`sh_YU` for Latin.
|
||||
A dictionary of the other script would flag every word, so it is never used.
|
||||
|
||||
## Revision history
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-31 | minor | Review › Language offers Serbian (Cyrillic and Latin); each run's language tag picks a dictionary in the script it names |
|
||||
| 2026-10-24 | minor | Local 0.37 candidate adds an opt-in native LXGW WenKai Lite glyph fallback and CJK interface-test coverage. This records local implementation only: managed tests, formatting, clippy, wasm-size and native GUI qualification remain pending. Browser font budget and uniform Chinese typography are unchanged. |
|
||||
| 2026-10-21 | minor | Review › Language can set the proofing language of the whole presentation |
|
||||
| 2026-10-14 | minor | IME composition in a table cell is underlined in place; the candidate window sits on that cell's caret |
|
||||
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
# UI parity with PowerPoint
|
||||
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-02 · **Change:** trivial (File › About replaces Account; product links, credits and appearance retained; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-10 · **Change:** trivial (File › Export › Change File Type and Save As export every slide as PNG or JPEG, #2019; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-26 · **Change:** trivial (dragging several selected slides moves them all; previous: trivial, Edit Points: Shift, Ctrl/Cmd or Alt/Option on a handle drag sets the point type; previous: trivial, scroll bars on the zoomed slide pane, #1157; previous: major, community PR wave 2026-10-14: 14 new dialogs (41 in all), Eyedropper, Export button, New Window, Grid Options, WordArt gallery and handles, Slide Sorter sections, Quick Access Toolbar, Format Background and Format Shape depth, rich-text clipboard; duplicated rows and headers folded; previous: minor, File tab / Backstage, #76) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-22 · **Change:** trivial (group fill and outline edits reach members, #1079; scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
|
||||
@@ -57,10 +57,10 @@ menu colours taken from the theme tokens (menu `chrome`, page `card`).
|
||||
| Open | Recent, Shared with Me, OneDrive, This PC, Add a Place, Browse; Presentations / Folders; Recover Unsaved Presentations | Recent and Browse (`app.openDialog`), recent presentations with a search box (`file.open`), Recover Unsaved Presentations (`file.recovery.open`). No cloud places or Folders tab |
|
||||
| Info | Name and path, Upload / Share / Copy path / Open file location; Protect, Inspect, Version History, Manage Presentation; Properties, Related Dates, Related People | Name and path, Copy path, Open file location; Inspect Presentation (Accessibility Checker), Manage Presentation (Revert); Size, Slides, Hidden slides and editable Title, Subject, Tags, Categories, Company, Comments, Author (`file.info`, `file.properties`). No Protect, Version History or dates |
|
||||
| Save | Saves; a presentation never saved goes to Save As | Same (`file.save`) |
|
||||
| Save As | Places, folder, file name, type, Save, More options | Type (PowerPoint, DeckCraft, PDF, Outline, PNG, JPEG) and Save, which opens the system Save dialog (web: Download). .pptx/.deckcraft take the new file; the others are copies (`file.saveAs`, `file.export`) |
|
||||
| Save As | Places, folder, file name, type, Save, More options | Type (PowerPoint, DeckCraft, PDF, Outline, PNG, JPEG, and PNG or JPEG of every slide, #2019) and Save, which opens the system Save dialog (web: Download). .pptx/.deckcraft take the new file; the others are copies (`file.saveAs`, `file.export`) |
|
||||
| Print | Print and Copies, Printer, Print All / Selection / Current / Custom Range, Slides box, layout (Full Page Slides, Notes Pages, Outline, Handouts 1–9), sides, collation, colour, Edit Header & Footer; page preview with pager and zoom | Print, Print All Slides / Current Slide / Custom Range, Slides box (`1-3, 5`), Full Page Slides / Notes Pages / Handouts 1–9, Print Hidden Slides, Frame Slides, Edit Header & Footer; preview with pager. DeckCraft prints through a PDF (`file.export`) opened in the system viewer, which has the printers (web: downloaded). No printer list, copies, sides or colour |
|
||||
| Share | Cloud sharing | Not offered |
|
||||
| Export | Create PDF/XPS Document, Create a Video, Create an Animated GIF, Package Presentation for CD, Create Handouts, Change File Type | Create PDF Document, Create Handouts (a PDF), Change File Type (PNG with an optional transparent background, #784). No video, GIF or CD package |
|
||||
| Export | Create PDF/XPS Document, Create a Video, Create an Animated GIF, Package Presentation for CD, Create Handouts, Change File Type | Create PDF Document, Create Handouts (a PDF), Change File Type (PNG or JPEG of the current slide or of every slide, #2019; PNG with an optional transparent background, #784). No video, GIF or CD package |
|
||||
| Close | Closes; asks Save / Don't Save / Cancel about unsaved changes | Same (`file.close` after the prompt); Ctrl+W asks too |
|
||||
| Account | User information, sign-in, Office Background and Office Theme, product information, About | About: product information, project links, contributor/model credits and appearance (light/dark, `view.dark`). No Account entry |
|
||||
| Options | Opens the PowerPoint Options dialog | Opens Preferences |
|
||||
@@ -173,6 +173,7 @@ consistency is open (#73, #56).
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-10 | trivial | Change File Type and Save As export every slide as PNG or JPEG (#2019); scores unchanged |
|
||||
| 2026-11-02 | trivial | File › About replaces Account; product links, credits and appearance retained |
|
||||
| 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged |
|
||||
| 2026-10-29 | trivial | Picture Format: the Picture Styles row shows as many styles as fit beside the groups after it (at least two) and a More arrow with all 24, as the Transitions and Animations galleries do; Crop and Size are in view in the default window (#1232) |
|
||||
|
||||
Reference in New Issue
Block a user