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. QMessageBox with Japanese characters gives "Missing font family" warning on macOS

QMessageBox with Japanese characters gives "Missing font family" warning on macOS

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.5k Views 3 Watching
  • 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.
  • E Offline
    E Offline
    efremdan1
    wrote on last edited by efremdan1
    #1

    I just upgraded from PySide2 to PySide6, and my application started giving me the error
    qt.qpa.fonts: Populating font family aliases took 713 ms. Replace uses of missing font family ".AppleSystemFallback" with one that exists to avoid this cost.
    when I display Japanese.

    In building a MWE, I found that this only occurs when using certain Qt functionality, such as message boxes. Although it's not in the MWE, I'm seeing it also when using QTranslator. Note that I didn't specify any non-default fonts.

    MWE below (adapted from the simple example given at https://doc.qt.io/qtforpython/quickstart.html). It shows the error occurring when you open a message box. If you comment out the lines mentioned, the error stops appearing even though the same characters appear.

    import sys
    import random
    from PySide6 import QtCore, QtWidgets, QtGui
    
    class MyWidget(QtWidgets.QWidget):
        def __init__(self):
            super().__init__()
    
            self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир", "こんにちは世界"]
    
            self.button = QtWidgets.QPushButton("Click me!")
            self.text = QtWidgets.QLabel("Hello World",
                                         alignment=QtCore.Qt.AlignCenter)
    
            self.layout = QtWidgets.QVBoxLayout(self)
            self.layout.addWidget(self.text)
            self.layout.addWidget(self.button)
    
            self.button.clicked.connect(self.magic)
    
        @QtCore.Slot()
        def magic(self):
            self.text.setText(random.choice(self.hello))
            # Commenting out the next 4 lines makes error disappear
            msgBox = QtWidgets.QMessageBox()
            msgBox.setIcon(QtWidgets.QMessageBox.Information)
            msgBox.setText("こんにちは世界") # NB: Replacing the Japanese characters in the message box with Привет мир also makes the error disappear, so the issue is specific to only certain character sets.
            msgBox.exec()
    
    if __name__ == "__main__":
        app = QtWidgets.QApplication([])
    
        widget = MyWidget()
        widget.resize(800, 600)
        widget.show()
    
        sys.exit(app.exec())
    

    I'm running Python 3.9.7 and PySide6 6.2.2 on macOS Big Sur 11.6.1.

    1 Reply Last reply
    0
    • SGaistS SGaist

      There must have been a change in the backend somewhere. I can reproduce it on Catalina with the latest PySide 6 (pyside6-6.2.2.1)

      It would recommend checking the bug report system to see if it's something known. The message does not appear with PySide2.

      E Offline
      E Offline
      efremdan1
      wrote on last edited by efremdan1
      #8

      @SGaist
      I don't see this in the bug report system, so I've reported it.

      https://bugreports.qt.io/browse/QTBUG-99216

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        How did you install Python and PySide6 ?

        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
        • E Offline
          E Offline
          efremdan1
          wrote on last edited by
          #3

          I use conda (version 4.10.3) to manage my Python environments. I ran conda create -n myenv python=3.9 to create the environment I used to run the script above, and after activating the environment, I installed PySide6 with pip install pyside6.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            efremdan1
            wrote on last edited by
            #4

            Giving this a bump...

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mchinand
              wrote on last edited by
              #5

              @efremdan1 said in QMessageBox with Japanese characters gives "Missing font family" warning on macOS:

              In building a MWE, I found that this only occurs when using certain Qt functionality, such as message boxes.

              When does it show the Japanese (and Cyrillic) characters correctly and when does it show it incorrectly?

              E 1 Reply Last reply
              0
              • M mchinand

                @efremdan1 said in QMessageBox with Japanese characters gives "Missing font family" warning on macOS:

                In building a MWE, I found that this only occurs when using certain Qt functionality, such as message boxes.

                When does it show the Japanese (and Cyrillic) characters correctly and when does it show it incorrectly?

                E Offline
                E Offline
                efremdan1
                wrote on last edited by
                #6

                @mchinand said in QMessageBox with Japanese characters gives "Missing font family" warning on macOS:

                When does it show the Japanese (and Cyrillic) characters correctly and when does it show it incorrectly?

                In the example, it always shows Cyrillic characters without any error messages. Japanese characters are also always shown correctly; however, an error message is shown (with an accompanying delay of ~713 ms) when the characters appear in a QMessageBox. If the QMessageBox isn't present, and the characters are only appearing in the QLabel, no error message is shown.

                1 Reply Last reply
                1
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  There must have been a change in the backend somewhere. I can reproduce it on Catalina with the latest PySide 6 (pyside6-6.2.2.1)

                  It would recommend checking the bug report system to see if it's something known. The message does not appear with PySide2.

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

                  E 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    There must have been a change in the backend somewhere. I can reproduce it on Catalina with the latest PySide 6 (pyside6-6.2.2.1)

                    It would recommend checking the bug report system to see if it's something known. The message does not appear with PySide2.

                    E Offline
                    E Offline
                    efremdan1
                    wrote on last edited by efremdan1
                    #8

                    @SGaist
                    I don't see this in the bug report system, so I've reported it.

                    https://bugreports.qt.io/browse/QTBUG-99216

                    1 Reply Last reply
                    1

                    • Login

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