[Interest] Qt uses fontconfig on Linux, but what about Windows?

Volker Hilsheimer volker.hilsheimer at qt.io
Mon Dec 18 12:01:45 CET 2023


On 18 Dec 2023, at 11:20, Allan Sandfeld Jensen <kde at carewolf.com> wrote:
On Montag, 18. Dezember 2023 05:14:38 CET Thomas Larsen Wessel wrote:
So in short, if I want to find a generic way of getting / querying /
installing fonts across OS'es (including Windows), fontconfig is probably
not the way to go, though it may technically be possible.

Yeah, that is complicated. I think you can do it with Qt APIs, but I wouldn't
know how myself.


For getting/querying, QFontDatabase is your friend.

For installing a font: if it’s enough to add the font so that your application can use it, then QFontDatabase::addApplicationFont, with a font file you ship separately or as a resource.

There's no API in Qt to install a font file with the system. Your application might not have the privileges to do so, so if you need that, then you’d probably best do that as part of your installation routine.


Volker

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231218/14e9fe19/attachment.htm>


More information about the Interest mailing list