Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Why fonts in Qt are appearing blurry or pixelated?
Forum Updated to NodeBB v4.3 + New Features

Why fonts in Qt are appearing blurry or pixelated?

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for pythonpythonpyside2pyside
11 Posts 3 Posters 4.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Abhay SalviA Offline
    Abhay SalviA Offline
    Abhay Salvi
    wrote on last edited by Abhay Salvi
    #1

    All my fonts are appearing pixelated, so I used AntiAliasing but it isn't helping. As you can see in the image itself:

    Capture.PNG

    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 with Qt, 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)

    1 Reply Last reply
    0
    • Abhay SalviA Offline
      Abhay SalviA Offline
      Abhay Salvi
      wrote on last edited by Abhay Salvi
      #2

      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:

      Capture.PNG

      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??

      1 Reply Last reply
      0
      • Abhay SalviA Offline
        Abhay SalviA Offline
        Abhay Salvi
        wrote on last edited by
        #3

        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:

        Capture.PNG

        1 Reply Last reply
        0
        • hskoglundH Online
          hskoglundH Online
          hskoglund
          wrote on last edited by
          #4

          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.

          Abhay SalviA 1 Reply Last reply
          2
          • hskoglundH hskoglund

            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.

            Abhay SalviA Offline
            Abhay SalviA Offline
            Abhay Salvi
            wrote on last edited by Abhay Salvi
            #5

            @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...

            1 Reply Last reply
            0
            • Abhay SalviA Offline
              Abhay SalviA Offline
              Abhay Salvi
              wrote on last edited by
              #6

              @hskoglund also tried all of your methods but none of them are working : (

              1 Reply Last reply
              0
              • hskoglundH Online
                hskoglundH Online
                hskoglund
                wrote on last edited by
                #7

                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:

                36vs38.png

                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.

                Abhay SalviA 1 Reply Last reply
                2
                • hskoglundH hskoglund

                  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:

                  36vs38.png

                  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.

                  Abhay SalviA Offline
                  Abhay SalviA Offline
                  Abhay Salvi
                  wrote on last edited by
                  #8

                  @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...

                  1 Reply Last reply
                  0
                  • hskoglundH Online
                    hskoglundH Online
                    hskoglund
                    wrote on last edited by
                    #9

                    Just tested on Windows 10, Notepad (with size 36) and setPointSize(36) look the same but setPixelSize(38) looks better I think:
                    Screenshot 2020-05-13 at 05.10.58.png

                    1 Reply Last reply
                    2
                    • hskoglundH Online
                      hskoglundH Online
                      hskoglund
                      wrote on last edited by
                      #10

                      So, if you can set the font size in points and only use those available in Notepad's list of sizes you should be ok.

                      Abhay SalviA 1 Reply Last reply
                      2
                      • hskoglundH hskoglund

                        So, if you can set the font size in points and only use those available in Notepad's list of sizes you should be ok.

                        Abhay SalviA Offline
                        Abhay SalviA Offline
                        Abhay Salvi
                        wrote on last edited by
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved