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

Emojis containing a presentation selector have broken rendering in fallback fonts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2, 6.2.0
    • GUI: Text handling
    • None
    • OS: Arch Linux x86_64 (kernel 5.14.9)
      DE: KDE
      Fontconfig: Noto Color Emoji is explicitly set as a fallback font for all of my top level font preferences.
    • Linux/X11

    Description

      Many emoji contain an emoji presentation selector, \uFE0F. This is expected and in fact Unicode recommend that keyboards and other input methods only generate emoji that are fully qualified, with all characters in an emoji sequence that do not have a default emoji presentation followed by a presentation selector indicating that they are intended to be viewed as emoji (instead of text).

      When an emoji sequence contains such a selector, the resulting emoji is broken in Qt applications. You will instead see the component parts of the emoji. If the selector is at the end of the emoji sequence, it may work by accident if there is not a text version of the emoji available (example: the <reminder ribbon> emoji). The downstream KDE bug was reported when a user noticed that instead of <transgender flag> they saw <white flag> and <transgender symbol>.

      My naive guess is that some special handling needs to be implemented for presentation selectors similar to the handling of the ZWJ character.

      Here's a trivial test case displaying two characters that are broken in QT apps as a result of this bug:

      from PyQt5.QtWidgets import QApplication, QMessageBox
      
      app = QApplication([])
      msg = QMessageBox()
      tc1_fq = 'Fully qualified: \u263a\ufe0f'
      tc1_uq = 'Unqualified: \u263a'
      tc2_fq = 'Fully qualified: \U0001f3f3\ufe0f\u200d\u26a7\ufe0f'
      tc2_uq = 'Unqualified: \U0001f3f3\u200d\u26a7'
      text = '\n'.join((tc1_fq,tc1_uq,tc2_fq,tc2_uq))
      msg.setText(text)
      msg.exec_()
      

      Adapting this for Qt 6, I found it works there as well. Note that the fully qualified smile displays as a text character because Qt is not rendering the presentation selector in the fallback (emoji) font.

      Footnote: I am unable to use the actual emoji characters in this report instead of text replacements like <white flag> because of an issue with your bug tracker described here.

      Attachments

        Issue Links

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              adamfontenot Adam Fontenot
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: