Skip to content

fix(qt): handle pixel-sized fonts when scaling widgets#7465

Draft
thepastaclaw wants to merge 2 commits into
dashpay:developfrom
thepastaclaw:tracker-1251
Draft

fix(qt): handle pixel-sized fonts when scaling widgets#7465
thepastaclaw wants to merge 2 commits into
dashpay:developfrom
thepastaclaw:tracker-1251

Conversation

@thepastaclaw

Copy link
Copy Markdown

Pixel-sized font scaling fix

Issue being fixed or feature implemented

GUIUtil::updateFonts() assumed every widget font had a positive point size. The recovery-phrase dialog stylesheet uses pixel-sized fonts, for which Qt reports an invalid point size, so an asynchronous global font refresh could abort while the dialog was open. This caused the original macOS report in #7281 and the cross-platform recurrence in #7464.

Fixes #7281.
Fixes #7464.

Supersedes the earlier closed draft #7315, which GitHub would not reopen after the branch was rebased onto current develop.

What was done?

  • Convert valid pixel-sized widget fonts to point sizes using the widget's logical DPI before applying the existing scaling path.
  • Skip widgets when Qt provides neither a valid point size nor a safely convertible pixel size.
  • Preserve fractional point sizes in the per-widget cache.
  • Add a focused Qt regression test covering a pixel-sized font passed through GUIUtil::updateFonts().

How Has This Been Tested?

  • Built qt/libbitcoinqt.a and test_dash_qt against current develop.
  • ./src/qt/test/test_dash-qt passes with the default minimal platform. On macOS, the focused font-test body is skipped under minimal, matching the existing AppTests platform limitation.
  • QT_QPA_PLATFORM=cocoa ./src/qt/test/test_dash-qt exercises and passes FontTests; the later full AppTests suite cannot run to completion in this headless macOS environment because Cocoa pasteboard initialization aborts.
  • git diff --check upstream/develop...HEAD passes.
  • Independent pre-PR code-review gate passes after target-branch integration validation.

Breaking Changes

None.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation, where applicable
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Stylesheets may set font-size in px, making pointSizeF() report -1 and
tripping assert(font.pointSize() > 0) in updateFonts(). Convert pixel
sizes to points when DPI is valid, otherwise skip the widget so invalid
DPI cannot divide by zero.

Fixes recovery-dialog / pixel-font crashes tracked in dashpay#7281/dashpay#7464.
Add FontTests that applies a pixel-sized font (recovery-dialog failure
mode) and asserts GUIUtil::updateFonts() no longer aborts and yields a
positive point size. Include the public API via guiutil.h after the
guiutil_font.h inline. Run FontTests before AppTests so cocoa can
exercise the regression path without full GUI startup.
@thepastaclaw

Copy link
Copy Markdown
Author

The linux64_ubsan-test / Test source failure is unrelated to this PR, so the branch is proper as-is and has been left untouched.

The failing test is feature_llmq_connections.py, which timed out waiting for DKG phase 2 / receivedContributions on all three in-job attempts. This PR changes only Qt font-scaling and Qt unit-test files; it does not change the functional test, its framework, or LLMQ code. The exact develop base passed the same UBSan test in 82 seconds, and this PR's normal linux64-test job passed as well.

Filed #7466 with the failure logs and reproduction evidence. No commit, push, rebase, or CI retrigger is appropriate for this PR.

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

Labels

None yet

Projects

None yet

1 participant