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

Qml font weight and styleName not working (not rendered correctly)

XMLWordPrintable

    • macOS, Windows

      I import different types of the font "Helvetica Neue":

      // load fonts from resources
      int fontId0 = QFontDatabase::addApplicationFont(":/font/HelveticaNeue-Regular.ttf");	
      int fontId1 = QFontDatabase::addApplicationFont(":/font/HelveticaNeue-CondensedBlack.ttf");	
      int fontId2 = QFontDatabase::addApplicationFont(":/font/HelveticaNeue-Light.ttf");	
      int fontId3 = QFontDatabase::addApplicationFont(":/font/HelveticaNeue-Thin.ttf");	
      int fontId4 = QFontDatabase::addApplicationFont(":/font/HelveticaNeue-UltraLight.ttf");
      

      In order to use e.g. "Helvetica Neue UltraLight" under macOS I have to set the font.styleName property to "UltraLight":

      font.styleName: "UltraLight"
      

      The same code doesn't work on Windows 10. 

      To use the same font on Windows 10 the font.weight property must be set to "Font.ExtraLight" (this in return is not working on macOS):

      font.weight: Font.ExtraLight
      

       

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            michelmuerner Michel Mürner
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes