Important: Please read the Qt Code of Conduct -

Chinese characters don't work when using custom platform abstraction with QGenericUnixFontDatabase

  • I have a custom platform abstraction (based off of the minimal example), that uses the QGenericUnixFontDatabase.

    I have UTF-16 strings.

    When I try to render this: just漢atest
    It shows up as this: justatest


    This displays correct on Ubuntu and Windows platforms.

    When I enumerator the available fonts on my embedded system, I get these results.

    "Bitstream Charter"
    "Bitstream Vera Sans"
    "Bitstream Vera Sans Mono"
    "Bitstream Vera Serif"
    "Courier 10 Pitch"
    "DejaVu Sans"
    "DejaVu Sans Mono"
    "DejaVu Serif"
    "Luxi Mono"
    "Luxi Sans"
    "Luxi Serif"

    Should I be using only certain fonts?

    I am using Qt 5.3.2. I have to use this version because of my Yocto embedded environment.

    UPDATE: I tried using every font available on the system, and non worked.

    painter.setFont(QFont("Utopia", 10, QFont::Bold));

  • Lifetime Qt Champion


    You'll likely have to add a font that supports Chinese characters to your system.

Log in to reply