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

Thomas Larsen Wessel mrvelle at gmail.com
Mon Dec 18 05:14:38 CET 2023


Thanks :) In case others will be looking / googling for this, I will try to
share what I found out in the meantime. Please correct me where I am wrong
:)

At first I thought fontconfig was more of a software library that should
serve as an intermediate layer between OS and whatever piece of software
one might build (in Qt or not). I thought it would serve as an abstraction
so that I could query / access (and maybe even install) fonts on the OS, no
matter if the OS is Windows, Linux, etc.

I think fontconfig is more like a service that is installed independently
(ie not something that comes bundled with a piece of software that one
installs) on the OS. It happens to be installed by default on at least most
Linux distributions (and maybe also on FreeBSD? MacOS?). It is possible to
install fontconfig on Windows (or at least it was at some point in the
past), but it is generally not a used or recommended solution. If one
Googles for this, the results are old and sparse.

This mailing list thread discusses fontconfig on Windows, and does not
exactly recommend it (
https://lists.freedesktop.org/archives/fontconfig/2007-October/002685.html):


> *fontconfig as a concept is rather foreign to Windows, so using it on*
> *Windows is not really "correct" (in a more philosophical sense)... One*
> *should use fontconfig on Windows only if the code absolutely requires*
> *fontconfig. At least, that's what Owen always says unless I'm**mistaken.
> But anyway, hopefully the above should give you some help.*


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.

Sincerely.


On Sun, Dec 17, 2023 at 7:53 PM Allan Sandfeld Jensen <kde at carewolf.com>
wrote:

> On Samstag, 16. Dezember 2023 15:58:00 CET Thomas Larsen Wessel wrote:
> > Quote from https://doc.qt.io/qt-6/qt-embedded-fonts.html:
> >
> > *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. In this
> > > case, Qt applications will look for fonts in Qt's lib/fonts/
> directory. Qt
> > > will automatically detect prerendered fonts and TrueType fonts.
> >
> > When a Qt application is running on Windows, does it also rely on
> > fontconfig?
>
>
> No, it uses Windowsø font system.
>
> Best regards
> Allan
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231218/219cb837/attachment.htm>


More information about the Interest mailing list