Repository navigation
#2069: WMF scale and offset mapping records place sub-pictures - #2266
Conversation
Move the craft-metafile pin to storytold/craft-libs f428c3d3, past craft-libs storytold#1816 (Hamza's mapping records from storytold#1183, with the frame fix). WMF files that draw sub-pictures with SCALEVIEWPORTEXT, SCALEWINDOWEXT, OFFSETVIEWPORTORG and OFFSETWINDOWORG now place each one in its part of the frame instead of stretching the first over it. Only craft-metafile moves; the other craft-libs pins are unchanged. The render test builds the issue's WMF in code and fails on the old pin: the right half is red, not blue.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟢 Approval recommended
The change is limited to a dependency pin update accompanied by a targeted WMF mapping-record regression test and corresponding documentation updates, with no remaining issues indicated in the provided review evidence.
No open issues 🎉
What changed in this PR
Moves DeckCraft’s craft-metafile dependency pin to a craft-libs revision that supports WMF scale/offset mapping records, fixing incorrect placement of WMF sub-pictures (e.g., older Office charts/clip art), and adds a regression test plus documentation updates.
Changes:
- Bump
craft-metafileto a newer craft-libs revision (and updateCargo.lock) to pick up WMF mapping-record handling. - Add a render regression test that constructs a minimal WMF and asserts correct left/right sub-picture placement after rasterization.
- Update roadmap and file-format parity documentation to reflect the fix and its revision history.
| File | Description |
|---|---|
| ROADMAP.md | Updates the project roadmap/progress log and revision history to record the #2069 fix landing. |
| docs/file-format-parity.md | Updates the EMF/WMF parity/status row and revision history to reflect improved WMF mapping-record support. |
| crates/render/src/tests.rs | Adds a regression test that programmatically builds a WMF exercising scale/offset mapping records and validates correct rasterized sub-picture placement. |
| Cargo.toml | Advances the craft-metafile git revision pin to the craft-libs commit that includes WMF mapping-record handling. |
| Cargo.lock | Updates the locked craft-metafile source line to match the new pinned git revision. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
No blocking problems found (not certain).
Moves the craft-metafile pin to a revision that handles the WMF scale and offset mapping records. Adds a test that builds a two-sub-picture WMF and checks where each circle lands.
- Cargo.toml:75 changes only the craft-metafile revision; the other craft-libs pins stay as they were.
- crates/render/src/tests.rs:3409
wmf_barewrites a correct 18-byte standard header and u32 record sizes, with odd-length parameters padded, so the test WMF is well formed. - crates/render/src/tests.rs:3436 the second sub-picture's window origin of -400, with the viewport width halved, places its circle at device x 420–780. The probes at x 50, 150 and 100 (of 200) therefore test left, right and the gap between them.
- craft-metafile now uses a different craft-libs revision from craft-pdf and craft-update. Worth confirming in Cargo.lock that no shared craft-libs crate ends up in two copies.
- docs/file-format-parity.md:57 and ROADMAP.md record the change in the existing revision-history format.
Claims checked:
- verified: craft-metafile moves to craft-libs f428c3d3 and the other craft-libs pins don't change (Cargo.toml:75 rev changes from 63196e66… to f428c3d36e0faf3924b76956a01334c051543527; the craft-pdf and craft-update lines in the same hunk keep rev 63196e66…)
- unverified: The lockfile diff is that one source line (Cargo.lock is not part of the reviewed diff; only Cargo.toml:75 changes in the manifest)
- verified: WMF pictures that place sub-pictures with SCALEVIEWPORTEXT, SCALEWINDOWEXT, OFFSETVIEWPORTORG and OFFSETWINDOWORG now draw each sub-picture in its part of the frame (fixes issue 2069) (crates/render/src/tests.rs:3436-3468 builds a WMF with SAVEDC, SCALEVIEWPORTEXT 1/2, SETWINDOWORG and SETWINDOWEXT…
- unverified: The new test fails on the old pin 63196e66 (crates/render/src/tests.rs:3466 the blue assertion would fail if the first circle were stretched over the frame, but the run on the old pin was not reproduced)
- verified: File-format parity doc and roadmap record the change (docs/file-format-parity.md:57 EMF / WMF row names the four records; docs/file-format-parity.md:122 and ROADMAP.md:162 and ROADMAP.md:356 add dated entries)
Reviewed at 06c7701.
Recommendation: merge, after a maintainer's decision.
|
AI-generated comment (Sonnet). Not a maintainer decision. Merged main into this branch to resolve the conflict. |
FredApps
left a comment
There was a problem hiding this comment.
Reviewed at 06c7701, which contains current main (0ccc68f).
- The change is scoped to the issue.
craft-metafilemoves from63196e66tof428c3d3, which is on craft-libsmain. The lockfile changes onesourceline, and the other craft-libs pins stay where they are. In craft-libs,crates/metafilechanges between the two revisions only through the scale/offset mapping records (aaa72308, 7585d2df, 8644532e) and the skipped-content counts (23317d32, 227ea620). Neither adds a new error return, so a WMF/EMF that opens today keeps opening. - I confirmed the test locally on Linux x86_64.
metafile_scaled_viewport_places_each_sub_picture_in_its_halfpasses on this head and fails with the pin set back to63196e66. - Hosted CI on this head passes: the Ubuntu gate, lockfile, font-pin, nix and SonarCloud.
- One note, not blocking: this adds a third craft-libs
revto the workspace (010702ee,63196e66,f428c3d3). That departs from the single-rev SHOULD in rule 10. Moving every crate here would widen the risk well beyond #2069, so a separate unification PR is the right place for it.
Not tested: rendering the issue's .pptx in the app, and platforms other than Linux.
Fixes #2069.
What was wrong
DeckCraft reads WMF through
craft-metafile, pinned at craft-libs63196e66. That revision skips the four relative mapping records (META_SCALEVIEWPORTEXT,META_SCALEWINDOWEXT,META_OFFSETVIEWPORTORG,META_OFFSETWINDOWORG). A WMF that draws sub-pictures with them (charts and clip art from older Office versions) stretches the first sub-picture over the whole frame and draws the rest outside it.The reader fix is already in craft-libs: Hamza's storytold/craft-libs#1183, merged through storytold/craft-libs#1816 together with its frame-sizing fix. #1183 notes that the issue stays open until DeckCraft's pin moves. This PR moves it.
What changed
Cargo.toml/Cargo.lock:craft-metafilemoves to craft-libsf428c3d3. The other craft-libs pins don't change. The lockfile diff is that onesourceline.crates/render/src/tests.rs:metafile_scaled_viewport_places_each_sub_picture_in_its_halfbuilds the issue's WMF in code. It has no placeable header, an 800 × 400 frame and two sub-pictures. The test rasterizes it throughmetafile::rasterizeand checks for red in the left half, blue in the right half and nothing between them.docs/file-format-parity.md(EMF / WMF row, status line, revision history) andROADMAP.md(progress log, status line, revision history).The other craft-metafile changes since the old pin are the skipped-content counts on
Picturefrom craft-libs #1918. They add fields only, and DeckCraft doesn't constructPicture. Showing those counts in the app is left for a follow-up.Testing (Linux x86_64)
63196e66blue circle in the right half: Rgba([255, 0, 0, 255]), the red ellipse stretched over the frame as reportedcargo test -p deckcraft-rendercargo clippy -p deckcraft-render --all-targets -- -D warningscargo fmt --all --checkcargo xtask layers,cargo xtask assets,cargo xtask wasmcargo metadata --lockedNot run: the full
cargo xtask ciworkspace sweep (tests and clippy for every crate).deckcraft-renderis the only crate that usescraft-metafile. I also didn't render the issue's.pptxin the app or the CLI; the test builds the same records in code.Summary by CodeRabbit