Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104790

QFontMetricsF operates differently from platform to platform

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.4, 6.3.1, 6.4.2
    • GUI: Font handling
    • None
    • Linux/X11, Windows

    Description

      If to set font's size in pixels and get QFontMetricsF for this font, then on different platforms, for example, QFontMetricsF::horizontanAdvance( ' ' ) returns different values for the same font for the same QPaintDevice (with the same DPI). Is it known issue?

      Maybe you can tell me a workaround? I need the same metrics for the absolutelly same font on all platforms.

      For example with

      QFont(Droid Serif,-1,83,5,400,0,0,0,0,0,0,0,0,0,0,32768)
      
      const QFontMetricsF fm(font, pd);
      const double sp=fm.horizontalAdvance(' ');
      

      returns 22 on Windows and 21.5469 on Linux.

      Attachments

        1. droid_serif.ttf
          168 kB
        2. main.cpp
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            igor.mironchik Igor Mironchik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes