summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-10-13 16:43:23 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2010-11-18 12:42:28 (GMT)
commit77218177d44bb120e4cb558cadeadc0bcf6c3cab (patch)
tree95b801953dcad329c59200151323c46ca52f1482 /src/gui/text
parented32a5262fcff59771628ed22425669f00784cb2 (diff)
downloadQt-77218177d44bb120e4cb558cadeadc0bcf6c3cab.zip
Qt-77218177d44bb120e4cb558cadeadc0bcf6c3cab.tar.gz
Qt-77218177d44bb120e4cb558cadeadc0bcf6c3cab.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
Diffstat (limited to 'src/gui/text')
-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 ecc4690..635d2cf 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1455,6 +1455,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;
@@ -1462,20 +1463,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));
}
@@ -1484,6 +1490,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);
}