[Interest] Glyph fallback

Ender Erel ender.erel at icterra.com
Wed Nov 20 15:38:45 CET 2013


I see, you are manually setting the widgets' fonts explicitly according to the language, which is not actually a fallback mechanism in my opinion. However, we are trying to avoid manually setting fonts throughout the application. What I really need is something like this:

...
QApplication::setFont("FontA");
QApplication::addFallbackFont("FontB");
QApplication::addFallbackFont("FontC");
...

I think it should be possible, from what I understand from this bug report:
https://bugreports.qt-project.org/browse/QTBUG-32470

About the fontconfig thing: sorry, i sent the wrong link. The correct link is this one:
http://qt-project.org/doc/qt-5.0/qtdoc/qt-embedded-fonts.html
In this page, it is stated that "Qt normally uses fontconfig to provide access to system fonts. If fontconfig is not available, e.g. in dedicated embedded systems where space is at a premium, Qt will fall back to using QBasicFontDatabase.", fallback is used when fontconfig does not exist, so I don't think that actually prevents Qt from using fontconfig as long as it is deployed in the target embedded system. I didn't try it on my target system yet, so I might be misunderstanding how it works.

P.S: Please reply to the list, not only to me :)

Regards,
Ender

-----Original Message-----
From: Alejandro Exojo [mailto:aexojo at modpow.es] 
Sent: Wednesday, November 20, 2013 4:24 PM
To: Ender Erel
Subject: Re: [Interest] Glyph fallback

2013/11/20 Ender Erel <ender.erel at icterra.com>:
> Can you please elaborate on how you are doing it currently? From what I understand, you are using two fonts simultaneously (latin, chinese), which I think is exactly what i need. What do you mean by "the fonts specified", where do you specify them?

Yes. We have some fonts for the western languages and one font for Chinese. When the language is changed, everything is working as expected since if Chinese is used, the glyphs are only available in one font, and that is picked as a fallback, with the "usual" ones still applying, e.g., for some big numbers and titles in one screen.

By "the fonts specified" I meant the fonts that we've setup through the application's widgets by the "font" property and stylesheets.

(It's been a while since I touched this things, so I might be mistaken in something.)

>> But fontconfig is not used in Qt for embedded Linux, isn't it? :-(
> I don't think so, Our current configuration uses legacy fontdir approach, but i think Qt can be built to use fontconfig, embedded or otherwise.
> See: 
> http://qt-project.org/doc/qt-4.7/qt-embedded-fonts.html#id-3f8b04d8-02
> f7-44c9-8990-343b812dda64

Mmmm, I don't see mentions of fontconfig there.

I can't remember the details, but I had to dig a bit on the issue (even the source, since is not very explicit in the docs), and what I understood is that Qt for Embedded Linux uses a custom solution for finding and selecting fonts, and trying to add fontconfig is a "no-op". I remember I had to recompile Qt with some FOO_DEBUG set to make that part of the code print the logic it was following for choosing fonts. If it can really use fontconfig on embedded and I misunderstood it, then its good news.

For rendering fonts, however, it uses the usual FreeType library (plus the custom QWS QPF).

> Alejandro: Sure, If i can sort this out, I will share how to do it with the list.

Good. :-)

--
Alejandro Exojo Piqueras

ModpoW, S.L.
Technova LaSalle | Sant Joan de la Salle 42 | 08022 Barcelona | www.modpow.es



More information about the Interest mailing list