[SCM] Qt 4 packaging branch, master, updated. debian/4.7.3-2-5-g542d61a

Fathi Boudra fabo at alioth.debian.org
Tue Jun 21 07:55:44 UTC 2011


The following commit has been merged in the master branch:
commit 542d61a9b716ac904da351d42b43bd6ed2122f2e
Author: Fathi Boudra <fabo at debian.org>
Date:   Tue Jun 21 10:54:34 2011 +0300

    Add patches cherry-picked upstream:
     - Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch
     - Fix_fontconfig_usage_in_X11_font_database.patch
---
 debian/changelog                                   |    3 +
 ...Fix_fontconfig_usage_in_X11_font_database.patch |  204 ++++++++++++++++++++
 ..._by_default_to_match_the_behavior_of_GTK+.patch |   53 +++++
 debian/patches/series                              |    2 +
 4 files changed, 262 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 8c8c977..45fd9dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ qt4-x11 (4:4.7.3-3) UNRELEASED; urgency=low
   * Add libqt4-dev-private package: ship Qt private headers to build Qt Creator
     QML Designer plugin.
   * Add missing epoch for qt4-linguist-tools Breaks/Replaces. (Closes: #630917)
+  * Add patches:
+    - Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch
+    - Fix_fontconfig_usage_in_X11_font_database.patch
 
  -- Fathi Boudra <fabo at debian.org>  Mon, 20 Jun 2011 15:29:58 +0300
 
diff --git a/debian/patches/Fix_fontconfig_usage_in_X11_font_database.patch b/debian/patches/Fix_fontconfig_usage_in_X11_font_database.patch
new file mode 100644
index 0000000..11de619
--- /dev/null
+++ b/debian/patches/Fix_fontconfig_usage_in_X11_font_database.patch
@@ -0,0 +1,204 @@
+From d9f1c15f10e1a1d076ea4810e708a4c5419b73d2 Mon Sep 17 00:00:00 2001
+From: Jiang Jiang <jiang.jiang at nokia.com>
+Date: Mon, 20 Jun 2011 13:47:01 +0200
+Subject: [PATCH] Fix fontconfig usage in X11 font database
+
+We should do FcConfigSubstitute(0, pattern, FcMatchFont) on a
+FcPattern for query because the family list in it will contain
+almost all the families after FcConfigSubstitute(0, pattern,
+FcMatchPattern), then the test in <match target="font"> will
+almost always succeed. In general, FcMatchFont substitute
+should only be done on the FcPattern that we got after
+FcFontMatch() or FcFontRenderPrepare().
+
+Based on the suggestion of fontconfig author Behdad Esfahbod,
+this patch reorganized the tryPatternLoad logic so that it only
+does the QFontEngine creation part, FcPattern *match is retrieved
+outside of that function. In this way, the match pattern we got
+can be either from FcFontMatch() or after FcFontRenderPrepare()
+on one of the fonts we got from qt_fontSetForPattern(). Then we
+don't need to duplicate the pattern and add all criterias back
+with qt_addPatternProps(). It not only simplified the code a lot
+but also fix the way we apply FcMatchFont substitution. This
+substitution will either be done by FcFontMatch() or
+FcFontRenderPrepare, both implicitly.
+
+Task-number: QTBUG-2148, QTBUG-19947
+Reviewed-by: Eskil
+---
+ src/gui/text/qfontdatabase_x11.cpp |   55 +++++++++++++++----------------------
+ src/gui/text/qfontengine_x11.cpp   |   22 ++++----------
+ 2 files changed, 29 insertions(+), 48 deletions(-)
+
+--- a/src/gui/text/qfontdatabase_x11.cpp
++++ b/src/gui/text/qfontdatabase_x11.cpp
+@@ -1545,9 +1545,8 @@ static FcPattern *getFcPattern(const QFo
+ 
+     qt_addPatternProps(pattern, fp->screen, script, request);
+ 
+-    FcDefaultSubstitute(pattern);
+     FcConfigSubstitute(0, pattern, FcMatchPattern);
+-    FcConfigSubstitute(0, pattern, FcMatchFont);
++    FcDefaultSubstitute(pattern);
+ 
+     // these should only get added to the pattern _after_ substitution
+     // append the default fallback font for the specified script
+@@ -1585,35 +1584,20 @@ static void FcFontSetRemove(FcFontSet *f
+         memmove(fs->fonts + at, fs->fonts + at + 1, len);
+ }
+ 
+-static QFontEngine *tryPatternLoad(FcPattern *p, int screen,
+-                                   const QFontDef &request, int script, FcPattern **matchedPattern = 0)
++static QFontEngine *tryPatternLoad(FcPattern *match, int screen,
++                                   const QFontDef &request, int script)
+ {
+ #ifdef FONT_MATCH_DEBUG
+     FcChar8 *fam;
+-    FcPatternGetString(p, FC_FAMILY, 0, &fam);
++    FcPatternGetString(match, FC_FAMILY, 0, &fam);
+     FM_DEBUG("==== trying %s
", fam);
+ #endif
+     FM_DEBUG("passes charset test
");
+-    FcPattern *pattern = FcPatternDuplicate(p);
+-    // add properties back in as the font selected from the
+-    // list doesn't contain them.
+-    qt_addPatternProps(pattern, screen, script, request);
+-
+-    FcConfigSubstitute(0, pattern, FcMatchPattern);
+-    FcDefaultSubstitute(pattern);
+-    FcResult res;
+-    FcPattern *match = FcFontMatch(0, pattern, &res);
+-
+-    if (matchedPattern)
+-	*matchedPattern = 0;
+ 
+     QFontEngineX11FT *engine = 0;
+     if (!match) // probably no fonts available.
+         goto done;
+ 
+-    if (matchedPattern)
+-	*matchedPattern = FcPatternDuplicate(match);
+-
+     if (script != QUnicodeTables::Common) {
+         // skip font if it doesn't support the language we want
+         if (specialChars[script]) {
+@@ -1652,11 +1636,6 @@ static QFontEngine *tryPatternLoad(FcPat
+         }
+     }
+ done:
+-    FcPatternDestroy(pattern);
+-    if (!engine && matchedPattern && *matchedPattern) {
+-        FcPatternDestroy(*matchedPattern);
+-        *matchedPattern = 0;
+-    }
+     return engine;
+ }
+ 
+@@ -1705,14 +1684,26 @@ static QFontEngine *loadFc(const QFontPr
+ #endif
+ 
+     QFontEngine *fe = 0;
+-    FcPattern *matchedPattern = 0;
+-    fe = tryPatternLoad(pattern, fp->screen, request, script, &matchedPattern);
++    FcResult res;
++    FcPattern *match = FcFontMatch(0, pattern, &res);
++    fe = tryPatternLoad(match, fp->screen, request, script);
+     if (!fe) {
+         FcFontSet *fs = qt_fontSetForPattern(pattern, request);
+ 
++        if (match) {
++            FcPatternDestroy(match);
++            match = 0;
++        }
++
+         if (fs) {
+-            for (int i = 0; !fe && i < fs->nfont; ++i)
+-                fe = tryPatternLoad(fs->fonts[i], fp->screen, request, script, &matchedPattern);
++            for (int i = 0; !fe && i < fs->nfont; ++i) {
++                match = FcFontRenderPrepare(NULL, pattern, fs->fonts[i]);
++                fe = tryPatternLoad(match, fp->screen, request, script);
++                if (fe)
++                    break;
++                FcPatternDestroy(match);
++                match = 0;
++            }
+             FcFontSetDestroy(fs);
+         }
+         FM_DEBUG("engine for script %d is %s
", script, fe ? fe->fontDef.family.toLatin1().data(): "(null)");
+@@ -1720,11 +1711,11 @@ static QFontEngine *loadFc(const QFontPr
+     if (fe
+         && script == QUnicodeTables::Common
+         && !(request.styleStrategy & QFont::NoFontMerging) && !fe->symbol) {
+-        fe = new QFontEngineMultiFT(fe, matchedPattern, pattern, fp->screen, request);
++        fe = new QFontEngineMultiFT(fe, match, pattern, fp->screen, request);
+     } else {
+         FcPatternDestroy(pattern);
+-        if (matchedPattern)
+-            FcPatternDestroy(matchedPattern);
++        if (match)
++            FcPatternDestroy(match);
+     }
+     return fe;
+ }
+--- a/src/gui/text/qfontengine_x11.cpp
++++ b/src/gui/text/qfontengine_x11.cpp
+@@ -863,11 +863,8 @@ glyph_t QFontEngineXLFD::glyphIndexToFre
+ // Multi FT engine
+ // ------------------------------------------------------------------
+ 
+-static QFontEngine *engineForPattern(FcPattern *pattern, const QFontDef &request,
+-                                     int screen)
++static QFontEngine *engineForPattern(FcPattern *match, const QFontDef &request, int screen)
+ {
+-    FcResult res;
+-    FcPattern *match = FcFontMatch(0, pattern, &res);
+     QFontEngineX11FT *engine = new QFontEngineX11FT(match, request, screen);
+     if (!engine->invalid())
+         return engine;
+@@ -879,9 +876,9 @@ static QFontEngine *engineForPattern(FcP
+ }
+ 
+ QFontEngineMultiFT::QFontEngineMultiFT(QFontEngine *fe, FcPattern *matchedPattern, FcPattern *p, int s, const QFontDef &req)
+-    : QFontEngineMulti(2), request(req), pattern(p), firstEnginePattern(matchedPattern), fontSet(0), screen(s)
++    : QFontEngineMulti(2), request(req), pattern(p), fontSet(0), screen(s)
+ {
+-
++    firstEnginePattern = FcPatternDuplicate(matchedPattern);
+     engines[0] = fe;
+     engines.at(0)->ref.ref();
+     fontDef = engines[0]->fontDef;
+@@ -907,8 +904,6 @@ void QFontEngineMultiFT::loadEngine(int
+     extern QMutex *qt_fontdatabase_mutex();
+     QMutexLocker locker(qt_fontdatabase_mutex());
+ 
+-    extern void qt_addPatternProps(FcPattern *pattern, int screen, int script,
+-                                   const QFontDef &request);
+     extern QFontDef qt_FcPatternToQFontDef(FcPattern *pattern, const QFontDef &);
+     extern FcFontSet *qt_fontSetForPattern(FcPattern *pattern, const QFontDef &request);
+ 
+@@ -940,22 +935,17 @@ void QFontEngineMultiFT::loadEngine(int
+     Q_ASSERT(at < engines.size());
+     Q_ASSERT(engines.at(at) == 0);
+ 
+-    FcPattern *pattern = FcPatternDuplicate(fontSet->fonts[at + firstFontIndex - 1]);
+-    qt_addPatternProps(pattern, screen, QUnicodeTables::Common, request);
+-
+-    QFontDef fontDef = qt_FcPatternToQFontDef(pattern, this->request);
++    FcPattern *match = FcFontRenderPrepare(NULL, pattern, fontSet->fonts[at + firstFontIndex - 1]);
++    QFontDef fontDef = qt_FcPatternToQFontDef(match, this->request);
+ 
+     // note: we use -1 for the script to make sure that we keep real
+     // FT engines separate from Multi engines in the font cache
+     QFontCache::Key key(fontDef, -1, screen);
+     QFontEngine *fontEngine = QFontCache::instance()->findEngine(key);
+     if (!fontEngine) {
+-        FcConfigSubstitute(0, pattern, FcMatchPattern);
+-        FcDefaultSubstitute(pattern);
+-        fontEngine = engineForPattern(pattern, request, screen);
++        fontEngine = engineForPattern(match, request, screen);
+         QFontCache::instance()->insertEngine(key, fontEngine);
+     }
+-    FcPatternDestroy(pattern);
+     fontEngine->ref.ref();
+     engines[at] = fontEngine;
+ }
diff --git a/debian/patches/Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch b/debian/patches/Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch
new file mode 100644
index 0000000..fb86b3f
--- /dev/null
+++ b/debian/patches/Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch
@@ -0,0 +1,53 @@
+commit 5c46d9a4c85abbcc0b5db2bbbafded3efd784cd9
+Author: Jiang Jiang <jiang.jiang at nokia.com>
+Date:   Thu Nov 25 17:30:32 2010 +0100
+
+    Take Xft.hintstyle by default to match the behavior of GTK+
+    
+    For Qt apps running in GNOME, we use the GTK+ settings by
+    default (instead of fontconfig settings).
+    
+    Task-number: QTBUG-13800
+    Reviewed-by: Samuel
+
+---
+ src/gui/kernel/qapplication_x11.cpp |    4 ++++
+ src/gui/text/qfontengine_x11.cpp    |    7 ++++++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/src/gui/kernel/qapplication_x11.cpp
++++ b/src/gui/kernel/qapplication_x11.cpp
+@@ -1589,6 +1589,9 @@ static void getXDefault(const char *grou
+         int v = strtol(str, &end, 0);
+         if (str != end)
+             *val = v;
++        // otherwise use fontconfig to convert the string to integer
++        else
++            FcNameConstant((FcChar8 *) str, val);
+     }
+ }
+ 
+@@ -2233,6 +2236,7 @@ void qt_init(QApplicationPrivate *priv,
+         }
+         getXDefault("Xft", FC_ANTIALIAS, &X11->fc_antialias);
+ #ifdef FC_HINT_STYLE
++        X11->fc_hint_style = -1;
+         getXDefault("Xft", FC_HINT_STYLE, &X11->fc_hint_style);
+ #endif
+ #if 0
+--- a/src/gui/text/qfontengine_x11.cpp
++++ b/src/gui/text/qfontengine_x11.cpp
+@@ -1015,7 +1015,12 @@ QFontEngineX11FT::QFontEngineX11FT(FcPat
+ #ifdef FC_HINT_STYLE
+     {
+         int hint_style = 0;
+-        if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch)
++        // Try to use Xft.hintstyle from XDefaults first if running in GNOME, to match
++        // the behavior of cairo
++        if (X11->fc_hint_style > -1 && X11->desktopEnvironment == DE_GNOME)
++            hint_style = X11->fc_hint_style;
++        else if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch
++                 && X11->fc_hint_style > -1)
+             hint_style = X11->fc_hint_style;
+ 
+         switch (hint_style) {
diff --git a/debian/patches/series b/debian/patches/series
index e6e53fa..69c5f9f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,6 +11,8 @@ Make_use_of_the_fast_image_paths.patch
 Add_support_for_QT_USE_DRAG_DISTANCE_env_var.patch
 Prevent_recursion_when_creating_window_surface.patch
 Fixed_bug_in_X11_backend_when_creating_translucent_windows.patch
+Take_Xft.hintstyle_by_default_to_match_the_behavior_of_GTK+.patch
+Fix_fontconfig_usage_in_X11_font_database.patch
 
 # qt-copy patches
 0195-compositing-properties.diff

-- 
Qt 4 packaging



More information about the pkg-kde-commits mailing list