[Qt-interest] Picking default fonts

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Tue Mar 23 09:49:43 CET 2010


Nikos Chantziaras wrote on Monday, March 22, 2010 8:54 PM:

>> ...
>> I guess what we're asking here for is CSS-like generic font names
>> (serif, sans-serif, monospace, cursive and fantasy):
>> 
>> http://www.w3.org/Style/Examples/007/fonts
> 
> Hey wait a minute.  This actually *does* work, lol.
> ...
> pretty neat, but where does that come from?   Is it Qt doing this or
> is it something along the path of KDE/FreeType/Fontconfig?

I think it is kind of both: Qt itself has some heuristics build in (the last time I checked that was with Qt 3 though, when trying to rip out the actual font file path from the Qt internals ;), but mostly it is the underlying font system (FreeType/Fontconfig) which decides what to with a given "font family name". E.g. there are "well-known" replacement mappings from "Arial" to "Helvetica", and apparently "Fantasy" gets mapped onto "Impact" (I do know the Impact font, but have never heard of "Fantasy", so I don't know whether that makes sense or not - according to your post it is correct).

Off course also the http://doc.trolltech.com/4.6/qfont.html#StyleHint-enum plays a role, e.g. if the font system absolutely has no clue about "The FooFont" family.

> I should probably test this on a Mac and Windows when I get the
> chance.

Also the Windows font API has a built-in "font matching" mechanism, and so does the Mac I strongly believe ;) (After all, doesn't play Apple also an important role when it comes to the definition of the TrueType/OpenType standard?)

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list