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

    painter.drawText(0,
                     0,
                     width(),
                     height(),
                     Qt::AlignCenter,
                     utf16string);
    

    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"
    "Courier 10 Pitch"
    "Cursor"
    "DejaVu Sans"
    "DejaVu Sans Mono"
    "DejaVu Serif"
    "Luxi Mono"
    "Luxi Sans"
    "Luxi Serif"
    "Utopia"
    

    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

    Hi,

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.