about font handling (and restore)

René J.V. Bertin rjvbertin at gmail.com
Tue Apr 21 10:03:51 BST 2015


Hi,

Any experts on font handling implementation on here?

It's been a while since I noticed that Qt 4.8 has problems in its typeface handling (weight & style combinations), noticeable esp. on OS X but not absent on Linux either. In a nutshell, creating a QFont from a family,weight,style triplet doesn't always return the expected typeface because Qt only recognises a (very) limited subset of known weights, with (almost) no support for synonyms at all.
KDE4 appears to mitigate the issue, but I'd not be surprised if that extra layer has disappeared in KF5, or has been incorporated somehow into Qt 5.

And Qt 5 (5.4) is just as affected by this issue, possible more even on Linux because the xcb platform plugin lacks helper functionality that exists on OS X and that can provide additional logic to disambiguate the potential matches for the user's request.

I admit I haven't yet had the chance to assess how this affects Calligra (Krita and Karbon most I'd guess), but before I spend a lot more time on the Qt patches that address this issue I thought I'd ask on here:

About Calligra/KDE4:
- how do you store fonts and then restore them when opening a document or parsing a settings file?
- does that work reliably, even less common fonts, weights and styles? Good test fonts are the Avenir Next and Helvetica Neue families (system fonts on OS X), or even the Segoe UI family that comes with all MS Windows machines.

And of course, has this already been done and tested for the KF5/Qt5 port?

I'm a bit in limbo here ... OTOH I hope my assessment is right and I'm at least making appropriate changes to improve a (probably flawed) implementation and OTOH I'm hoping I'm fighting windmills (because the Qt guys seem to think this is only a "nice to have" fix).

I just can't see the windmill when I do (in Qt 5.4, or without the "this" argument in Qt 4.8):

QFont font = QFontDialog::getFont(&ok, QFont(), this, "Select Font", options);
QFont font2 = QFont(font.family(), font.pointSize(), font.weight(), font.italic());
QFont font3 = QFontDialog::getFont(&ok, font2, this, "Select Font", options);

and the second dialog gives me a different font than the one selected in the 1st and indeed font3==font2!=font ...

Thanks,
René



More information about the calligra-devel mailing list