Skip to content

obs-text: Fix changing fonts for Qt 6.7+#12483

Open
RytoEX wants to merge 3 commits into
obsproject:masterfrom
RytoEX:fix-new-qt-font-styles
Open

obs-text: Fix changing fonts for Qt 6.7+#12483
RytoEX wants to merge 3 commits into
obsproject:masterfrom
RytoEX:fix-new-qt-font-styles

Conversation

@RytoEX

@RytoEX RytoEX commented Aug 8, 2025

Copy link
Copy Markdown
Member

Description

Add support for variable font weights to obs-text (the GDI+ Text Source).

Instead of simply checking if a font is bold or not (which in Qt is equivalent to font.weight() > Medium / font.weight() > 500),

Motivation and Context

Fixes #12393

https://doc.qt.io/qt-6.8/qfont.html#Weight-enum
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-logfontw

How Has This Been Tested?

Tested locally on Windows 11.

For the most part, this improves user experience when using variable fonts. Some changes, such as between Regular and Medium styles, still do not seem to show a difference, even if the code does not actually call UpdateFont().

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@RytoEX RytoEX added this to the OBS Studio 31.1 milestone Aug 8, 2025
@RytoEX RytoEX requested review from Lain-B and PatTheMav August 8, 2025 17:46
@RytoEX RytoEX self-assigned this Aug 8, 2025
@RytoEX RytoEX added kind/bug Categorizes issue or PR as related to a bug. Seeking Testers Build artifacts on CI platform/windows Categorizes issue or PR as affecting Windows specifically labels Aug 8, 2025
@RytoEX

RytoEX commented Aug 8, 2025

Copy link
Copy Markdown
Member Author

Will dig into this a bit more. It seems the QFont isn't fully initialized until after QFontDialog returns, and I'll have to determine if we need to deal with the font weight at all in the properties-view.

@Lain-B Lain-B left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Outside of the build issues this seems fine 👍

@AnoHez

AnoHez commented Jan 19, 2026

Copy link
Copy Markdown

Is there a completed build that can be tested?

@RytoEX RytoEX force-pushed the fix-new-qt-font-styles branch from 6e5b2d7 to 23b3793 Compare January 27, 2026 18:35
@RytoEX

RytoEX commented Jan 27, 2026

Copy link
Copy Markdown
Member Author

Rebased this. Will push additional fixes later to see if those help.

@RytoEX RytoEX force-pushed the fix-new-qt-font-styles branch 2 times, most recently from 13872f7 to a4cbbd6 Compare January 27, 2026 18:40
Also, fix the comparison order for font size to be consistent with the
other comparisons.
@RytoEX RytoEX force-pushed the fix-new-qt-font-styles branch from a4cbbd6 to 91cb6be Compare January 27, 2026 18:56
@RytoEX

RytoEX commented May 8, 2026

Copy link
Copy Markdown
Member Author

Testing on #12393 indicates that the primary issue is based in Qt. Though, some of these changes are probably still "correct", they do not directly address the issue, so this PR itself can be lowered in priority.

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

Labels

kind/bug Categorizes issue or PR as related to a bug. platform/windows Categorizes issue or PR as affecting Windows specifically Seeking Testers Build artifacts on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some fonts do not render correctly as of v31.1.0-beta1

5 participants