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

Text does not render with named fonts, even if FontLoader is used

    XMLWordPrintable

Details

    • 89cfe9eb01ad75c14121dbd6038b7c791226acf1, d281f94c30aa15765c9c1ec0a613311514033076 (4.8)

    Description

      From the output of Qt.fontFamilies(), it appears that the QML engine is only finding a limited subset of the installed fonts. Although Tahoma is an installed font on my system, the Text element is unable to render text with this font.

      It seems this cannot be fixed by using a FontLoader either. E.g. below, the FontLoader loads the attached RoundStyleSimple.ttf (from openfontlibrary.org) and reports its status as FontLoader.Ready, but the text is not rendered with this font.

      Both text elements in the example below appear to be rendered with the default font.

      import QtQuick 2.0
      
      Row {
      
          Text {
             font.family: "Tahoma"
             font.pixelSize: 30
             text: "Hello"
          }
      
          Text {
             font.family: loader.name
             font.pixelSize: 30
             text: "Hello"
          }
      
          FontLoader {
              id: loader
              source: "RoundStyleSimple.ttf"
              onStatusChanged: print("FontLoader status:", status)
              Component.onCompleted: print("FontLoader starting status:", status)
          }
      
          Component.onCompleted: {
              print("Found fonts:", Qt.fontFamilies())
          }
      }
      

      Attachments

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

        Activity

          People

            jiang Jiang Jiang
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes