Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using Colour Emojis as a substitution font in Windows
QtWS25 Last Chance

Using Colour Emojis as a substitution font in Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
windows 10color emojisfont match
12 Posts 4 Posters 5.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boring32
    wrote on 19 Apr 2018, 10:07 last edited by
    #1

    Hi all,
    my application is using MS Shell Dlg 2 font on windows. When an emoji is used on a QLabel or QLineEdit the emoji shows as black and white. It is my understanding that when an character is not available in a font, qt will try to find a replacement from the fonts available for the application http://doc.qt.io/qt-5/qfont.html#fontmatching
    When I use QFont::insertSubstitution(font().family(), "Segoe UI Emoji"); the result is b/w emojis.
    I also tried setStyleSheet(QString("font-family: 'MS Shell Dlg 2', 'segoe ui emoji', 'segoe ui symbol';")); but no luck.
    When I set the font of the widget to use "Segoe UI Emoji" font, then the color emojis are used.

    When I try the same on linux (with different system and emojis fonts) with insertSubstitution it works like a charm. Any ideas how can I get the behaviour I want? (that is use a font for characters and a different font of my preference for emojis). How can I make the font matching algorithm to do this?

    Thank you for your time in advance 😃

    1 Reply Last reply
    1
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 19 Apr 2018, 20:37 last edited by
      #2

      Hi and welcome to devnet,

      Can you provide a minimal sample code that reproduce this behaviour ?

      What version of Qt are you using ?
      On what version of Windows ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        boring32
        wrote on 20 Apr 2018, 00:30 last edited by VRonin
        #3

        Hi SGaist,

        Thank your for your reply.
        Currently using Windows 10 + Qt 5.8 but I will check with 5.10 as well.
        Here is a code sample demonstrating the issue:

        QApplication app(argc, argv);
        QWidget *mainWindow = new QWidget();
        
        QLayout *layout = new QVBoxLayout();
        QLabel *widget1 = new QLabel();
        QLabel *widget2 = new QLabel();
        QLabel *widget3 = new QLabel();
        
        QFont::insertSubstitution(QApplication::font().family(), "Segoe UI Emoji");
        
        widget1->setText("B/W Emoji \xF0\x9F\x92\xA4");
        widget1->setFont(QFont("Sans Serif"));
        
        widget2->setText("Color Emoji \xF0\x9F\x92\xA4");
        widget2->setFont(QFont("Segoe UI Emoji"));
        
        widget3->setText("Should be Color Emoji \xF0\x9F\x92\xA4");
        
        layout->addWidget(widget1);
        layout->addWidget(widget2);
        layout->addWidget(widget3);
        mainWindow->setLayout(layout);
        
        mainWindow->show();
        return app.exec();
        
        1 Reply Last reply
        0
        • B Offline
          B Offline
          boring32
          wrote on 23 Apr 2018, 08:27 last edited by
          #4

          Tried with Qt 5.10 and getting the same result.
          Here is a screen grab of the code above:

          0_1524471971239_fa891d72-58dc-4e10-b4fd-c6e737d4b58f-image.png

          D 1 Reply Last reply 26 Sept 2018, 02:50
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 24 Apr 2018, 21:15 last edited by
            #5

            How did you install that font in your system ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            B 1 Reply Last reply 25 Apr 2018, 11:08
            0
            • S SGaist
              24 Apr 2018, 21:15

              How did you install that font in your system ?

              B Offline
              B Offline
              boring32
              wrote on 25 Apr 2018, 11:08 last edited by
              #6

              @SGaist
              It is part of windows 10, a native font installed with windows.
              Currently on Windows 10 build 1709.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 25 Apr 2018, 21:40 last edited by
                #7

                Strange, it sounded like QTBUG-57717 but it should work.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  boring32
                  wrote on 27 Apr 2018, 10:02 last edited by
                  #8

                  Do you think I should file a bug report for this?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 27 Apr 2018, 21:13 last edited by
                    #9

                    If you can't find anything else on the bug report system then yes.

                    Can you check with the latest test version of 5.11 before doing that ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • B Offline
                      B Offline
                      boring32
                      wrote on 30 Apr 2018, 12:51 last edited by
                      #10

                      Just tried 5.11 beta and still there.
                      I will check the bugs again and then report.
                      Thank you for your help @SGaist

                      1 Reply Last reply
                      0
                      • B boring32
                        23 Apr 2018, 08:27

                        Tried with Qt 5.10 and getting the same result.
                        Here is a screen grab of the code above:

                        0_1524471971239_fa891d72-58dc-4e10-b4fd-c6e737d4b58f-image.png

                        D Offline
                        D Offline
                        dr_W
                        wrote on 26 Sept 2018, 02:50 last edited by
                        #11

                        @boring32 In the above example, have you tried using emoji on win7? Why does the use of emoji color on win7 turn black and white?

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          tofutim
                          wrote on 23 Oct 2018, 16:52 last edited by tofutim
                          #12

                          I wanted to report that when I use 5.9.4 MinGW the color emoji shows up as BW but when I use 5.9.4 MSVC2017 the color emoji shows up as color. Is there anything I can do to get MinGW to work? Same in 5.11.

                          I'm using a blank project with a single color emoji in the screen.

                          0_1540313956160_2018-10-23_0958.png

                          If I compile with MSVC2017 then it shows up in color.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved