Skip to content

PPTX: a paragraph's own default run properties (pPr/defRPr) reach its runs (#411) - #452

Closed
MarekSpodBiedry wants to merge 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-411
Closed

MarekSpodBiedry wants to merge 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-411

Conversation

@MarekSpodBiedry

Copy link
Copy Markdown
Contributor

Fixes #411.

dml::paragraph called ppr but threw away its third value, the paragraph's a:pPr/a:defRPr. Runs, breaks and fields were read from their own a:rPr only. So a paragraph that set size, bold, colour and so on in defRPr, with runs that did not repeat them, lost that formatting on import.

The fix keeps the defRPr result. After the paragraph is read, it merges those properties into every text run, break and field, and into the end-of-paragraph mark (endParaRPr), with RunProps::inherit. inherit only fills fields that are still None, so the order the issue asks for holds: direct rPr beats 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_style already used the same third value of ppr for lvlNpPr/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 with defRPr sz="3000" b="1", one run with no rPr, one run that sets only sz="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 are None.

@MarekSpodBiedry
MarekSpodBiedry marked this pull request as ready for review October 13, 2026 15:46
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* 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.
@Harrison-Booth

Copy link
Copy Markdown
Contributor

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 FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MarekSpodBiedry

Copy link
Copy Markdown
Contributor Author

Closing: main already fixes #411 in f9d5a43, which keeps the paragraph's pPr/defRPr as the paragraph's own default properties, passes them to its runs and writes them back. Copying them into each run, as this PR does, no longer fits that design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Audit] PPTX paragraph-local defRPr formatting is discarded during import

3 participants