Skip to content

fix: fall back to default DPI when GTK returns 0 on Linux#50488

Merged
jkleinsc merged 1 commit into
40-x-yfrom
trop/40-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460278142
Mar 26, 2026
Merged

fix: fall back to default DPI when GTK returns 0 on Linux#50488
jkleinsc merged 1 commit into
40-x-yfrom
trop/40-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460278142

Conversation

@trop

@trop trop Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Backport of #50453

See that PR for details.

Notes: none.

GetDefaultPrinterDPI() creates a blank GtkPrintSettings and reads
its resolution, which returns 0 for uninitialized settings. With
DPI=0, SetPrintableAreaIfValid() computes a zero scale factor,
producing empty page dimensions that fail PrintMsgPrintParamsIsValid().

Fall back to kDefaultPdfDpi (72) when GTK returns 0, matching the
existing Windows fallback pattern when CreateDC fails.

Co-authored-by: Shelley Vohr <[email protected]>
@trop trop Bot requested review from a team and codebytere March 25, 2026 17:38
@trop trop Bot added 40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 25, 2026
@jkleinsc jkleinsc merged commit 904fbbd into 40-x-y Mar 26, 2026
148 of 154 checks passed
@jkleinsc jkleinsc deleted the trop/40-x-y-bp-fix-fall-back-to-default-dpi-when-gtk-returns-0-on-linux-1774460278142 branch March 26, 2026 15:47
@release-clerk

release-clerk Bot commented Mar 26, 2026

Copy link
Copy Markdown

No Release Notes

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

Labels

40-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant