[Qt-interest] Picking default fonts
Nikos Chantziaras
realnc at arcor.de
Tue Mar 23 18:44:06 CET 2010
On 03/23/2010 10:49 AM, Oliver.Knoll at comit.ch wrote:
> 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 "Fan
> tasy", 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?)
OK, I just tested on OS X (10.6.2). This doesn't work at all there. It
always picks "Helvetica" for "serif", "sans-serif", "monospace" and the
rest.
And even on Linux, now I'm not sure what happens if someone isn't using
KDE or Gnome.
I suppose styleHint is the answer on non-X11 platforms since it doesn't
work on X11 where symbolic font names seem to be the best choice.
More information about the Qt-interest-old
mailing list