Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt font size difference across Mac OS and Windows
QtWS25 Last Chance

Qt font size difference across Mac OS and Windows

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.7k Views
  • 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.
  • D Offline
    D Offline
    David Jacobson
    wrote on 9 Aug 2018, 15:59 last edited by
    #1

    Hello,

    I'm developing a Qt (PyQt) app that runs on both Mac OS and Windows. I am puzzled by some of the dramatic apparent font size differences of specific Qt widgets, while other widgets display consistently (assuming no changes to code). Specifically, Qt widgets like; QDateTimeEdit, cells of QTableWidget ... seem to render extremely large under Windows and extremely small under Mac OS, while both being set to the same 8 point font-size in the Qt code. ?

    And, conversely, widgets like QLabel, and item rows of QListWidget, have font-sizes that seem to render consistently in size across both OS platforms.

    Any advice for my novice dev experience in Qt would be greatly appreciated.

    Thank you,

    David J.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      David Jacobson
      wrote on 9 Aug 2018, 20:27 last edited by David Jacobson 8 Oct 2018, 05:42
      #4

      Ok, I had some font inheritance discrepancies across my app for the main window + dialog window, etc. And this thread from another forum gave me some good insight on the best fonts for portability (i.e.: Verdana, Tahoma, Arial, etc.).

      https://community.filemaker.com/thread/164550

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mpergand
        wrote on 9 Aug 2018, 18:11 last edited by
        #2

        Hi,

        A font size of 8 points is very small on Mac

        QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
        return a 9 point as minimum size on Mac:
        QFont( ".Lucida Grande UI,9,-1,5,50,0,0,0,0,0" )

        Maybe you can use this fonction to get a more compatible small size font across platforms.

        Another possibility is to use the general font :
        QFontDatabase::systemFont(QFontDatabase::GeneralFont)
        or simply QFont();

        and apply a small factor to its size.
        That's what i'm using in my apps.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          David Jacobson
          wrote on 9 Aug 2018, 19:40 last edited by
          #3

          Thanks for the suggestion. I will try out yours and more fonts. A little more detail; my confusion is where there are dramatic differences in the widget font sizes even on the same dialog + same font, only the OS changed.

          For example, why would font "MS Shell Dlg 2, Point Size 8" (the Qt Creator default under Windows) set on a QDateTimeEdit widget look huge under Windows, and tiny under Mac... yet, the same font "MS Shell Dlg 2, Point Size 8" set on a QLabel, look fine on both OSs? (not tiny under Mac OS)

          Another example; why would font "Segoe UI, Point Size 9" set on a QListWidget look fine on both Windows and Mac OS, yet the same "Segoe UI, Point Size 9" set on a QTableWidget look huge on Windows, and tiny on Mac OS?

          Scratching my head on the rendering diffs between widget types...

          Thanks for any insight!

          1 Reply Last reply
          0
          • D Offline
            D Offline
            David Jacobson
            wrote on 9 Aug 2018, 20:27 last edited by David Jacobson 8 Oct 2018, 05:42
            #4

            Ok, I had some font inheritance discrepancies across my app for the main window + dialog window, etc. And this thread from another forum gave me some good insight on the best fonts for portability (i.e.: Verdana, Tahoma, Arial, etc.).

            https://community.filemaker.com/thread/164550

            1 Reply Last reply
            1

            3/4

            9 Aug 2018, 19:40

            • Login

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