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

QPainterPath breaks emoji rendering

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 5.12.4
    • GUI: Painting
    • None
    • Linux/X11

    Description

      Emoji support in QPainterPath::addText() is missing and renders whitespace characters instead. QPainter::renderText() works fine, until QPainterPath::addText() is called somewhere in the source code and the added text contains emoji. If there is no emoji in the text added via QPainterPath::addText(), there is no problem. I am attaching a PyQT example of the issue for ease of experiments, but this issue was present in case of native C++ implementation too .

      #!/usr/bin/python3
      
      import sys
      from PyQt5.QtWidgets import QWidget, QApplication
      from PyQt5.QtGui import QPainter, QColor, QFont, QPainterPath
      from PyQt5.QtCore import Qt, QT_VERSION_STR
      
      
      class Example(QWidget):
          def __init__(self):
              super().__init__()
              self.initUI()
              
              
          def initUI(self):      
              self.text = "check the emoji -> � <- that is here"
              self.show()
              
      
          def paintEvent(self, event):
              qp = QPainter()
              qp.begin(self)
              pp = QPainterPath()
              # IF THE FOLLOWING LINE IS UNCOMMENTED, IT BREAKS BOTH TEXTS
              # pp.addText(10, 10, QFont(), self.text)
              # ^^^^^^^^^^^^^^
              qp.drawPath(pp)
              qp.drawText(event.rect(), Qt.AlignCenter, self.text)        
              qp.end()
      
                      
              
      if __name__ == '__main__':
          print(QT_VERSION_STR)
      
          app = QApplication(sys.argv)
          ex = Example()
          sys.exit(app.exec_())
      
      

       
      tested on Kubuntu 19.10

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            suricactus Ivan Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes