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

QtQuick - Colored fonts seems not supported

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.2
    • Fix Version/s: None
    • Component/s: GUI: Font handling
    • Labels:
      None
    • Environment:
      Windows 10 Pro 64 bit, version no. 1809. Computer Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 16.0 GB RAM
    • Platform/s:
      Windows

      Description

       
      In Qt Quick, I'm trying to draw a text with a colored font using this code:

      Text
      {
          FontLoader
          {
              id: ftCustomFont;
              source: "Fonts/Colortube-lWAd.otf"
          }
      
          textFormat: Text.RichText
      
          text:
          {
              if (ftCustomFont.status == FontLoader.Ready)
                  qsTr("<font face=\"" + ftCustomFont.name + "\">test test test</font>");
              else
              if (ftCustomFont.status == FontLoader.Loading)
                  "Loading..."
              else
              if (ftCustomFont.status == FontLoader.Error)
                  "Error loading font"
          }
      }

      The font I'm using above was downloaded here: https://www.fontspace.com/neogrey-creative/colortube

      Using this font, I expected that a colored text was drawn, however I get this result:

      As you can see, the text is drawn with the correct font, but in black&white. I also tried with several colored font samples, downloaded from several sites, unfortunately none of them could draw a colored text.

      Is there a way to notify Qt to use the colored glyphs instead of the B&W ones while the text is drawn? How should I configure my qml code above to achieve a such effect? Or Qt doesn't support the colored fonts at all?

      NOTE this issue is also followed here:

      https://stackoverflow.com/questions/59537825/qt-quick-how-to-draw-a-text-with-a-colored-font

        Attachments

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

          Activity

            People

            Assignee:
            esabraha Eskil Abrahamsen Blomfeldt
            Reporter:
            jeanmilost Jean-Milost Reymond
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes