Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.7, 6.8
-
None
-
Rocky 9.2
Description
This issue is reproducible in Qt Designer in Qt 6.7 and later, with the following stylesheet:
QWidget
{ font-family: fixed; font-style: normal; font-size: 14px; font-weight: bold; }Drag a QPushButton onto the frame, and make it bigger.
Edit the text by adding and removing characters in the text field.
Notice that if there are an odd number of characters in the text field and the widget's width is also odd, the font renders correctly.
If there are an even number of characters in the text field and the widget's width is also even, the font renders correctly,
but if the width is odd and the number of characters are even, the font is rendered as blurred by anti-aliasing.
Note: the widget's height also has to be even. If the widget's height is odd, the font renders blurry in the vertical direction.
Before Qt 6.7, the fixed typeface font would render correctly, aligned with the pixel grid in all of the above scenarios.
Since it is a pixel-based font, it shouldn't be anti-aliased. You can't turn anti-aliasing on or off via the stylesheet, but it should respect the fontconfig settings. For this font, Qt ignores any fontconfig settings for antialiasing and it blurs the font regardless of what fontconfig says. You can directly set the Antialiasing property for the font, but if the style is appllied via a stylesheet at runtime, you can't configure that property according to a font selected in the stylesheet.
By contrast, if "dejavusansmono" is used as the font with size "12px" (those settings have similar size properties to the fixed, size 14px font), whether anti-aliased or not, it manages to keep itself aligned with the pixel grid via hinting - and Qt respects the fontconfig settings for this font (dejavusansmono) unless explicitly overwritten.
For some reason Qt 6.7 is defaulting to Antialiasing the fixed typeface, even though the font doesn't support antialiasing; it's ignoring fontconfig's setting for it to not antialias, and it's effectively blurring the font if centering doesn't align it with the pixel grid.
The solution could be: Qt defaulting antialiasing to off for fonts like the fixed typeface.
or Qt respecting the fact that fontconfig configures antialiasing to be off for the fixed typeface.