diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-30 05:19:47 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-30 05:51:02 (GMT) |
commit | 4da9590140c063551f261b883fb275cafe986b60 (patch) | |
tree | 6e76868d18748155c3748711e21e394306ca519a /src/gui/text | |
parent | 0056c0a654a930fe082787ec7e8579a6e74d9ad5 (diff) | |
download | Qt-4da9590140c063551f261b883fb275cafe986b60.zip Qt-4da9590140c063551f261b883fb275cafe986b60.tar.gz Qt-4da9590140c063551f261b883fb275cafe986b60.tar.bz2 |
Fix use of bitmap fonts on some Linux systems
In 30bd59a1dec78 we added a fallback from font config
to XLFD in the case where font config could not supply
us with the correct pixel size for a given font.
Primarily, this was for when you would try to print
a bitmap font on a high resolution printer. This caused
a problem for applications that set a point size on
a bitmap font, since the calculated pixel size would
not be available. For UIs you will usually prefer to
select the font with the correct family but nearest
pixel size here, which is what font config does. We
would however choose the fallback and if XLFD failed
to load the font in question, you would get a
substitution. Since getting the correct font family
seems more important than getting the correct pixel
size, we disable the fallback in the case where XLFD
does not find the correct font. This will fix the bug
where UI fonts were frequently created with the wrong
family on e.g. Fedora, and it might cause some trouble
with printing bitmap fonts, however, it was deemed
that bitmap fonts are not ideal fonts to use for
printing. In cases where XLFD can load the bitmap
fonts, the fallback will still be used.
Task-number: QTBUG-4428
Reviewed-by: Trond
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontdatabase_x11.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index b1ab478..3b2e4e9 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1939,8 +1939,13 @@ void QFontDatabase::load(const QFontPrivate *d, int script) fe = loadFc(d, script, req); if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) { - delete fe; - fe = loadXlfd(d->screen, script, req); + QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req); + if (xlfdFontEngine->fontDef.family == fe->fontDef.family) { + delete fe; + fe = xlfdFontEngine; + } else { + delete xlfdFontEngine; + } } |