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

Displaying coloured emojis with emojione in a QLabel causes segfault on linux with hidpi

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.9.3
    • 5.9.2
    • GUI: Font handling
    • None

    Description

      Setting the contents of a QLabel to display colored emojis using emojione with HTML span attributes causes issues on linux with hidpi displays: emojis images are corrupted (only displaying a quarter of the full emoji) and the program quickly crashes with a segfault.

      Disabling HiDpi scaling with `Qt::AA_DisableHighDpiScaling` prevents both the crash and the rendering issues. So does using system fonts instead of emojione (but thus emojis are displayed non-colored).

      Small reproducing example:

      #include <QApplication>
      #include <QFontDatabase>
      #include <QLabel>
      
      int main(int argc, char *argv[])
      {
          //QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
          QApplication a(argc, argv);
          QFontDatabase::addApplicationFont("./emojione-android.ttf");
          QLabel   label;
          label.setText("Hello world <span style=\"font-family: Noto Color Emoji;\">\U0001F609</span>");
          label.show();
          return a.exec();
      }
      

      (this example uses the emojione android font ("Noto Color Emoji") that can be downloaded here: https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-android.ttf )

      On the above example, uncommenting the first line of main prevents the crash.

      Attachments

        Issue Links

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

          Activity

            People

              allan.jensen Allan Sandfeld Jensen
              levans levans
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes