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 Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 601 Views
  • 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 17 Jun 2016, 16:16 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Jun 2016, 21:05 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

      1/2

      17 Jun 2016, 16:16

      • Login

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