Repository navigation
PPTX: a paragraph's own default run properties (pPr/defRPr) reach its runs (#411) - #452
MarekSpodBiedry wants to merge 1 commit into
Conversation
* Print: Windows lists its printers and spools jobs (storytold#756) The Print dialog's printer list comes from Win32_Printer through PowerShell's CIM (wmic is gone from Windows 11), and jobs are spooled by the embedded windows_print.ps1: the in-box Windows.Data.Pdf renders each sheet at the printer's own resolution and System.Drawing.Printing carries copies, collation, duplex and colour as the job's settings. Both run through powershell, so the Rust code touches no Win32 API. Fixes storytold#756, with the printer-not-showing duplicates storytold#160, storytold#244, storytold#293, storytold#465 and storytold#644; CIM approach from storytold#452. On CI a paused Generic / Text Only test printer catches the job in its queue; a parser test keeps the script valid PowerShell. * Print: fix the Windows await helper and render the job on CI (dry run) Real-machine testing found [System.WindowsRuntimeSystemExtensions]::GetMethods() failing with 'does not contain a method named GetMethods': GetMethods is an instance method of [Type], so it is called with '.', the form the canonical WinRT-await snippets use, not '::'. The first CI run missed it because the end-to-end test skipped silently when the runner refused the test printer, so the script had never actually run. The script now honours PDFCRAFT_PRINT_DRYRUN=1: render every sheet with Windows.Data.Pdf to PNGs in the temporary folder and print nothing. The test runs that half unconditionally, so CI exercises the whole WinRT path — projection, await helpers, render — on any machine, while the paused-printer half stays best-effort and prints why it skipped. Win32_Printer enumeration asks only for Name and Default, so a machine with nine printers waits less. * Tests: the find-options wait in the viewer test is a deadline too 4280f83 converted the frame-count waits in this test to deadlines after the same 12-of-15 race under a full workspace test run, but left the first wait — the one for the 'page' matches — on the old 60-frame loop, and it flaked the same way on PR storytold#847's CI. Same fix: wait up to 20 s for the 15 matches, then assert.
|
This now conflicts with main after the module split in #1433 (the files moved into modules; see docs/ path map PR 1468). If you would rather not, I can open a PR that credits you, keeps your commits and shows a git range-diff against this one, so you'll still get credit and have visible work. |
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: PPTX import applies a paragraph's own default run properties (a:pPr/a:defRPr) to its runs (#411). The reader keeps the paragraph's defaults and, after the runs are read, applies them with the order "direct run properties win over the paragraph's own defaults, which win over the list styles". That is the order PowerPoint uses, so the oracle matches. Applying the defaults to runs that already have a property set must not overwrite it, and a paragraph's end-of-paragraph properties (a:endParaRPr) are a different element that must not be confused with it. A test with a direct size, a paragraph default size and a list style size, and a check that the exported file round-trips, would show it. I have not run it, and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
Fixes #411.
dml::paragraphcalledpprbut threw away its third value, the paragraph'sa:pPr/a:defRPr. Runs, breaks and fields were read from their owna:rPronly. So a paragraph that set size, bold, colour and so on indefRPr, with runs that did not repeat them, lost that formatting on import.The fix keeps the
defRPrresult. After the paragraph is read, it merges those properties into every text run, break and field, and into the end-of-paragraph mark (endParaRPr), withRunProps::inherit.inheritonly fills fields that are stillNone, so the order the issue asks for holds: directrPrbeats the paragraph default, and the paragraph default beats the list and master styles, which only fill what is still unset. Inline math runs are skipped, because they never carry run properties on import.list_stylealready used the same third value ofpprforlvlNpPr/defRPr.Round trip: the model has no paragraph-level default field, so the merged values are written back as each run's own
rPr. The text looks the same, and nothing is lost.Test:
paragraph_default_run_props_reach_runs(crates/pptx/src/read/dml.rs). It reads a paragraph withdefRPr sz="3000" b="1", one run with norPr, one run that sets onlysz="1200", and a break. It checks that the plain run gets 30 pt bold, the partial run keeps 12 pt and still gets bold, the break gets 30 pt, and the end mark gets 30 pt. It fails on main, where those values areNone.