[Interest] Font selection in Qt Embedded

Frank Hunleth fhunleth at troodon-software.com
Mon Jul 15 16:03:10 CEST 2013


I'm using Qt Embedded and having trouble getting Qt to pick the right
font for a language. The application that I'm working on has
translations for most of the European languages, Chinese, Japanese,
Korean, Hebrew and Arabic. I'm mostly using fonts from the Droid Sans
family. The desire is that the script-specific font gets tried first
and then it falls back to other fonts (possibly Droid Sans Fallback).
If I rebuild for the desktop, everything works perfectly (but I'm
pretty sure that's thanks to fontconfig.) Given that Qt Embedded
doesn't have fontconfig, I wasn't expecting it to work as well, but I
was hoping that it would be good enough.

Here's what I'm seeing:

   1. European languages, Chinese, and Japanese appear to work right.
I.e. it appears that the glyph is chosen either from the
script-specific ttf file or Droid Sans Fallback if not found.
   2. Hebrew, Arabic, and Korean do not work. If I specify the family
for the text, e.g. "Droid Sans Arabic", I can generate the right
output for that specific language, but in that case, non-Arabic code
points don't render correctly.

So far, I've traced things down to the font engine caching
(QFontEngineData::engines array). The array is indexed by
QUnicodeTables::Script. Interestingly, all of the languages that
appear to work for me evaluate to QUnicodeTables::Common and all of
the languages that appear to not work evaluate to something else
(Hebrew, Arabic, Hangul).

At this point, I think that I'm doing something wrong as I'd expect
others who use Qt Embedded to have multilingual applications and also
want to use ttf files that don't have all of the Unicode code points
in them.

Has anyone else solved this without using fontconfig? Or if the
default Qt Embedded setup just doesn't support this, is it possible to
have a Qt Embedded/fontconfig setup (I really can't enable X11)?

Thanks,
Frank



More information about the Interest mailing list