Why fonts in Qt are appearing blurry or pixelated?
-
All my fonts are appearing pixelated, so I used
AntiAliasing
but it isn't helping. As you can see in the image itself:This is the code I am using:
butt1 = QtWidgets.QLabel("""Scrappr""") font = QtGui.QFont() font.setStyleStrategy(QtGui.QFont.PreferAntialias) font.setPixelSize(22) font.setFamily('Segoe UI Bold') butt1.setFont(QtGui.QFont(font))
Edit 1: I also tried different combinations of
ClearType
text but It didn't work out. I think because for me, by default all the text appears good on windows and chrome but withQt
, it becomes pixelated. So it's probably not a windows problem...BTW I have:
1360 X 768
resolution.
PySide2 version is(5.14.2.1)
-
It didn't work @Denni-0 I copied your code and pasted it, but still, it's giving me the same pixelated output : (
You can see here:
By the way thanks for your help.
I think, maybe there's something wrong with my PC...
If it's working for you then why not for me?? -
Oh my god! None of them are working. I tried all the fonts and all are pixelated!
Even basic fonts like Arial & Impact also : (
See the result with Impact font: -
Hi, Qt on Windows7 can have this problem if you have set the resolution for the screen for text size not 100% in the control panel but something bigger like 125% or 150%.
Also you can try switch to Windows 7 Classic Desktop or Windows 7 Basic Desktop instead of Aero Desktop. -
@hskoglund hey thanks for answering...
I have one more question. If this is the problem with QT for windows 7 Aero then why other software like Adobe illustrator's font isn't messed up like mine.
I don't think they are built on electron/Html like VSCode or slack.
I simply don't get it.
However thanks for answering... -
@hskoglund also tried all of your methods but none of them are working : (
-
Hi, I just tested on my Windows7 PC with the Impact font and I think it looks better if you use
font.setPointSize(36)
instead of
font.setPixelSize(38)
, here's a screenshot:On the top you see Notepad's version, then Qt first using .setPointSize(36) then using .setPixelSize(38).
Note that 36 looks much better than 38. Why? If you look in the font settings for Notepad, you'll see that not all font sizes, for example when using the Impact font, are present. On my Windows 7 I can see 22, 24, 26, 28, 36, 48 and 72. So I think if you select a number between those you'll get a more ugly look.
-
@hskoglund Okay, so you mean this is windows 7 problem. Is it there on windows 10 also?
Lastly please suggest the right thing to do in such a situation. I am building a SaaS app using QT and setting fonts at this problematic size where pixels are still there will make the UI more messed up. What should I do now?
Any of your suggestions will be helpful... -
This post is deleted!