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

[5.9 REG] Garbled text rendering with QLabel and alpha channel

    XMLWordPrintable

Details

    Description

      This example:

      #include <QApplication>
      #include <QLabel>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QLabel *label = new QLabel();
          label->setText("abc");
          label->setStyleSheet("background-color: rgba(255, 247, 133, 0.8);"
                               "color: black;"
                               "font: 20pt Monospace");
          label->show();
      
          return app.exec();
      }
      
      TEMPLATE = app
      TARGET = labeltest
      QT += widgets
      SOURCES += main.cpp
      

      with the following ~/.config/fontconfig/fonts.conf:

      <?xml version="1.0"?>
      <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
      <fontconfig>
       <match target="font">
        <edit name="rgba" mode="assign">
         <const>rgb</const>
        </edit>
       </match>
      </fontconfig>
      

      Looks properly on Qt 5.8:

      But wrong on Qt 5.9:

      I was able to bisect this to the following change in qtbase: https://codereview.qt-project.org/#/c/171930/

      Replace QDrawHelperGammaTables with QColorProfile

      Turns the two set of tables in QDrawHelperGammaTables into two
      QColorProfile classes that use similar structures and can be reused for
      other gamma correction.
      At the same time clean-up and improve the comma-correct blending code
      to use the new profiles and QRgba64 precision.

      Attachments

        1. bad.png
          1 kB
          Florian Bruhin
        2. good.png
          1 kB
          Florian Bruhin
        3. qtbug60469.zip
          1.0 kB
          Friedemann Kleint

        Issue Links

          For Gerrit Dashboard: QTBUG-60469
          # Subject Branch Project Status CR V

          Activity

            People

              allan.jensen Allan Sandfeld Jensen
              the compiler Florian Bruhin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes