summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-10-13 16:43:23 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:59 (GMT)
commitd4cd998fecb5f005a5d02fcfe1514bad2a0baa6b (patch)
tree5f1aa68a0fad53f3b754aa3fbed78d17e49d396c
parentd6912358e673870ed01c57d334fbb4542ce44395 (diff)
downloadQt-d4cd998fecb5f005a5d02fcfe1514bad2a0baa6b.zip
Qt-d4cd998fecb5f005a5d02fcfe1514bad2a0baa6b.tar.gz
Qt-d4cd998fecb5f005a5d02fcfe1514bad2a0baa6b.tar.bz2
Fix fontconfig pattern merging
When merging fontconfig patterns, we need to clean up existing object first, otherwise the added object will be appended instead of replacing the existing object. When multiple font engines are using shaping, if fontconfig patterns are not correctly merged, it will result using the old font. For instance, in "<b>Fake Bold</b> Normal", "Normal" text will continue using the font for "Fake Bold" (that only happen with fallback fonts). Task-number: QTBUG-14455 Reviewed-by: Eskil
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index 2fa16bb..67bcc7a 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1462,6 +1462,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
weight_value = FC_WEIGHT_DEMIBOLD;
else if (request.weight < (QFont::Bold + QFont::Black) / 2)
weight_value = FC_WEIGHT_BOLD;
+ FcPatternDel(pattern, FC_WEIGHT);
FcPatternAddInteger(pattern, FC_WEIGHT, weight_value);
int slant_value = FC_SLANT_ROMAN;
@@ -1469,20 +1470,25 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
slant_value = FC_SLANT_ITALIC;
else if (request.style == QFont::StyleOblique)
slant_value = FC_SLANT_OBLIQUE;
+ FcPatternDel(pattern, FC_SLANT);
FcPatternAddInteger(pattern, FC_SLANT, slant_value);
double size_value = qMax(qreal(1.), request.pixelSize);
+ FcPatternDel(pattern, FC_PIXEL_SIZE);
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, size_value);
int stretch = request.stretch;
if (!stretch)
stretch = 100;
+ FcPatternDel(pattern, FC_WIDTH);
FcPatternAddInteger(pattern, FC_WIDTH, stretch);
if (X11->display && QX11Info::appDepth(screen) <= 8) {
+ FcPatternDel(pattern, FC_ANTIALIAS);
// can't do antialiasing on 8bpp
FcPatternAddBool(pattern, FC_ANTIALIAS, false);
} else if (request.styleStrategy & (QFont::PreferAntialias|QFont::NoAntialias)) {
+ FcPatternDel(pattern, FC_ANTIALIAS);
FcPatternAddBool(pattern, FC_ANTIALIAS,
!(request.styleStrategy & QFont::NoAntialias));
}
@@ -1491,6 +1497,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD
Q_ASSERT(script < QUnicodeTables::ScriptCount);
FcLangSet *ls = FcLangSetCreate();
FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]);
+ FcPatternDel(pattern, FC_LANG);
FcPatternAddLangSet(pattern, FC_LANG, ls);
FcLangSetDestroy(ls);
}