Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Chinese characters don't work when using custom platform abstraction with QGenericUnixFontDatabase
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 618 Views 1 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.
  • T Offline
    T Offline
    theonlylawislove
    wrote on last edited by theonlylawislove
    #1

    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));
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      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

      • Login

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