aboutsummaryrefslogtreecommitdiff
path: root/x11-toolkits/qt33/files
diff options
context:
space:
mode:
authorMichael Nottebrock <lofi@FreeBSD.org>2006-01-08 19:32:36 +0000
committerMichael Nottebrock <lofi@FreeBSD.org>2006-01-08 19:32:36 +0000
commit7710b55bc3f0d213f6344fa1a608919c44a344b5 (patch)
tree55eace3b8e7907f8b07ed3c7b0695add019fe3b0 /x11-toolkits/qt33/files
parent27f7ce2fe2b84f6569fce9b395c31ff011d9ae1a (diff)
downloadports-7710b55bc3f0d213f6344fa1a608919c44a344b5.tar.gz
ports-7710b55bc3f0d213f6344fa1a608919c44a344b5.zip
Notes
Diffstat (limited to 'x11-toolkits/qt33/files')
-rw-r--r--x11-toolkits/qt33/files/0065-fix_werror_with_gcc4.patch137
-rw-r--r--x11-toolkits/qt33/files/0066-fcsort2fcmatch.patch236
-rw-r--r--x11-toolkits/qt33/files/0067-nofclist.patch378
3 files changed, 751 insertions, 0 deletions
diff --git a/x11-toolkits/qt33/files/0065-fix_werror_with_gcc4.patch b/x11-toolkits/qt33/files/0065-fix_werror_with_gcc4.patch
new file mode 100644
index 000000000000..7e6a799e3f14
--- /dev/null
+++ b/x11-toolkits/qt33/files/0065-fix_werror_with_gcc4.patch
@@ -0,0 +1,137 @@
+qt-bugs@ issue : none yet
+bugs.kde.org number : none
+applied: no
+author: Dirk Mueller <mueller@kde.org>
+
+
+Index: src/kernel/qasyncimageio.h
+===================================================================
+--- src/kernel/qasyncimageio.h (revision 467438)
++++ src/kernel/qasyncimageio.h (working copy)
+@@ -44,6 +44,9 @@
+
+ #ifndef QT_NO_ASYNC_IMAGE_IO
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
+
+ class Q_EXPORT QImageConsumer {
+ public:
+Index: src/kernel/qucomextra_p.h
+===================================================================
+--- src/kernel/qucomextra_p.h (revision 467438)
++++ src/kernel/qucomextra_p.h (working copy)
+@@ -54,6 +54,9 @@
+ #include <private/qucom_p.h>
+ #endif // QT_H
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
+
+ class QVariant;
+
+Index: src/kernel/qnetworkprotocol.h
+===================================================================
+--- src/kernel/qnetworkprotocol.h (revision 467438)
++++ src/kernel/qnetworkprotocol.h (working copy)
+@@ -47,6 +47,10 @@
+
+ #ifndef QT_NO_NETWORKPROTOCOL
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
++
+ class QNetworkProtocol;
+ class QNetworkOperation;
+ class QTimer;
+Index: src/kernel/qimageformatinterface_p.h
+===================================================================
+--- src/kernel/qimageformatinterface_p.h (revision 467438)
++++ src/kernel/qimageformatinterface_p.h (working copy)
+@@ -40,6 +40,9 @@
+ #include <private/qcom_p.h>
+ #endif // QT_H
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
+
+ //
+ // W A R N I N G
+Index: src/dialogs/qfiledialog.h
+===================================================================
+--- src/dialogs/qfiledialog.h (revision 467438)
++++ src/dialogs/qfiledialog.h (working copy)
+@@ -58,6 +58,10 @@
+ #include "qurlinfo.h"
+ #endif // QT_H
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
++
+ #ifndef QT_NO_FILEDIALOG
+
+ class Q_EXPORT QFileIconProvider : public QObject
+Index: src/tools/qucom_p.h
+===================================================================
+--- src/tools/qucom_p.h (revision 467438)
++++ src/tools/qucom_p.h (working copy)
+@@ -59,6 +59,10 @@
+ #undef check
+ #endif
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
++
+ struct QUObject;
+ struct QUInterfaceDescription;
+ struct QUnknownInterface;
+Index: src/tools/qcom_p.h
+===================================================================
+--- src/tools/qcom_p.h (revision 467438)
++++ src/tools/qcom_p.h (working copy)
+@@ -53,6 +53,10 @@
+ #include "quuid.h"
+ #endif // QT_H
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
++
+ #ifndef QT_NO_COMPONENT
+
+ class QObject;
+Index: src/widgets/qtooltip.h
+===================================================================
+--- src/widgets/qtooltip.h (revision 467438)
++++ src/widgets/qtooltip.h (working copy)
+@@ -42,6 +42,9 @@
+
+ #ifndef QT_NO_TOOLTIP
+
++#if __GNUC__ - 0 > 3
++#pragma GCC system_header
++#endif
+
+ class QTipManager;
+ class QIconViewToolTip;
+Index: src/widgets/qmainwindow.cpp
+===================================================================
+--- src/widgets/qmainwindow.cpp (revision 467438)
++++ src/widgets/qmainwindow.cpp (working copy)
+@@ -287,8 +287,9 @@
+ {
+ public:
+ QHideToolTip( QWidget *parent ) : QToolTip( parent ) {}
++ ~QHideToolTip() {}
+
+- void maybeTip( const QPoint &pos );
++ virtual void maybeTip( const QPoint &pos );
+ };
+ #endif
+
diff --git a/x11-toolkits/qt33/files/0066-fcsort2fcmatch.patch b/x11-toolkits/qt33/files/0066-fcsort2fcmatch.patch
new file mode 100644
index 000000000000..c379f7be9e65
--- /dev/null
+++ b/x11-toolkits/qt33/files/0066-fcsort2fcmatch.patch
@@ -0,0 +1,236 @@
+qt-bugs@ issue : none yet
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak@kde.org>
+
+When finding a matching fontconfig font, try first FcFontMatch() before
+the noticeably more expensive FcFontSort(). Usually the first hit is enough,
+so there's no need to list all matching fonts.
+
+Note that this patch apparently triggers a bug in certain fontconfig versions
+(e.g. 2.2.99 or 2.3.90 crash, while e.g. 2.3.2 or 2.3.92 seem to work fine).
+
+--- src/kernel/qfontdatabase_x11.cpp.sav 2005-12-01 15:18:06.000000000 +0100
++++ src/kernel/qfontdatabase_x11.cpp 2005-12-01 18:17:33.000000000 +0100
+@@ -1787,106 +1787,137 @@ static QFontEngine *loadFontConfigFont(c
+ FcCharSetDestroy(cs);
+ }
+
+- FcResult result;
+- FcFontSet *fs = FcFontSort(0, pattern, FcFalse, 0, &result);
+- FcPatternDestroy(pattern);
+- if (!fs)
+- return 0;
++ QFontEngine *fe = 0;
++
++ for( int jj = 0; jj < 2; ++jj ) {
++ bool use_fontsort = ( jj == 1 );
++
++ FcResult result;
++ FcFontSet *fs;
++ FcPattern *fsp;
++ if( use_fontsort ) {
++ fs = FcFontSort(0, pattern, FcFalse, 0, &result);
++ if (!fs)
++ continue;
++ } else {
++ fsp = FcFontMatch(0, pattern, &result);
++ if (!fsp)
++ continue;
++ }
+
+ #ifdef FONT_MATCH_DEBUG
+- printf("fontset contains:\n");
+- for (int i = 0; i < fs->nfont; ++i) {
+- FcPattern *test = fs->fonts[i];
+- FcChar8 *fam;
+- FcPatternGetString(test, FC_FAMILY, 0, &fam);
+- printf(" %s\n", fam);
+- }
++ if( use_fontsort ) {
++ printf("fontset contains:\n");
++ for (int i = 0; i < fs->nfont; ++i) {
++ FcPattern *test = fs->fonts[i];
++ FcChar8 *fam;
++ FcPatternGetString(test, FC_FAMILY, 0, &fam);
++ printf(" %s\n", fam);
++ }
++ } else {
++ printf("fontmatch:");
++ FcChar8 *fam;
++ FcPatternGetString(fsp, FC_FAMILY, 0, &fam);
++ printf(" %s\n", fam);
++ }
+ #endif
+
+- int ch = sampleCharacter(script).unicode();
+- double size_value = request.pixelSize;
+- if ( size_value > MAXFONTSIZE_XFT )
+- size_value = MAXFONTSIZE_XFT;
+-
+- QFontEngine *fe = 0;
++ int ch = sampleCharacter(script).unicode();
++ double size_value = request.pixelSize;
++ if ( size_value > MAXFONTSIZE_XFT )
++ size_value = MAXFONTSIZE_XFT;
+
+- for (int i = 0; i < fs->nfont; ++i) {
+- FcPattern *font = fs->fonts[i];
+- FcCharSet *cs;
+- FcResult res = FcPatternGetCharSet(font, FC_CHARSET, 0, &cs);
+- if (res != FcResultMatch)
+- continue;
+- if (!FcCharSetHasChar(cs, ch))
+- continue;
+- FcBool scalable;
+- res = FcPatternGetBool(font, FC_SCALABLE, 0, &scalable);
+- if (res != FcResultMatch || !scalable) {
+- int pixelSize;
+- res = FcPatternGetInteger(font, FC_PIXEL_SIZE, 0, &pixelSize);
+- if (res != FcResultMatch || QABS((size_value-pixelSize)/size_value) > 0.2)
+- continue;
+- }
++ int cnt = use_fontsort ? fs->nfont : 1;
++
++ for (int i = 0; i < cnt; ++i) {
++ FcPattern *font = use_fontsort ? fs->fonts[i] : fsp;
++ FcCharSet *cs;
++ FcResult res = FcPatternGetCharSet(font, FC_CHARSET, 0, &cs);
++ if (res != FcResultMatch)
++ continue;
++ if (!FcCharSetHasChar(cs, ch))
++ continue;
++ FcBool scalable;
++ res = FcPatternGetBool(font, FC_SCALABLE, 0, &scalable);
++ if (res != FcResultMatch || !scalable) {
++ int pixelSize;
++ res = FcPatternGetInteger(font, FC_PIXEL_SIZE, 0, &pixelSize);
++ if (res != FcResultMatch || QABS((size_value-pixelSize)/size_value) > 0.2)
++ continue;
++ }
+
+- XftPattern *pattern = XftPatternDuplicate(font);
+- // add properties back in as the font selected from the list doesn't contain them.
+- addPatternProps(pattern, key, FALSE, TRUE, fp, request);
++ XftPattern *pattern = XftPatternDuplicate(font);
++ // add properties back in as the font selected from the list doesn't contain them.
++ addPatternProps(pattern, key, FALSE, TRUE, fp, request);
+
+- XftPattern *result =
+- XftFontMatch( QPaintDevice::x11AppDisplay(), fp->screen, pattern, &res );
+- XftPatternDestroy(pattern);
++ XftPattern *result =
++ XftFontMatch( QPaintDevice::x11AppDisplay(), fp->screen, pattern, &res );
++ XftPatternDestroy(pattern);
+
+- // We pass a duplicate to XftFontOpenPattern because either xft font
+- // will own the pattern after the call or the pattern will be
+- // destroyed.
+- XftPattern *dup = XftPatternDuplicate( result );
+- XftFont *xftfs = XftFontOpenPattern( QPaintDevice::x11AppDisplay(), dup );
++ // We pass a duplicate to XftFontOpenPattern because either xft font
++ // will own the pattern after the call or the pattern will be
++ // destroyed.
++ XftPattern *dup = XftPatternDuplicate( result );
++ XftFont *xftfs = XftFontOpenPattern( QPaintDevice::x11AppDisplay(), dup );
+
+- if ( !xftfs ) {
+- // Xft couldn't find a font?
+- qDebug("couldn't open fontconfigs chosen font with Xft!!!");
+- } else {
+- fe = new QFontEngineXft( xftfs, result, 0 );
+- if (fp->paintdevice
+- && QPaintDeviceMetrics(fp->paintdevice).logicalDpiY() != QPaintDevice::x11AppDpiY()) {
+- double px;
+- XftPatternGetDouble(result, XFT_PIXEL_SIZE, 0, &px);
+- scale = request.pixelSize/px;
+- }
+- fe->setScale( scale );
+- fe->fontDef = request;
+- if ( script != QFont::Unicode && !canRender(fe, script) ) {
+- FM_DEBUG( " WARN: font loaded cannot render sample 0x%04x", ch );
+- delete fe;
+- fe = 0;
++ if ( !xftfs ) {
++ // Xft couldn't find a font?
++ qDebug("couldn't open fontconfigs chosen font with Xft!!!");
++ } else {
++ fe = new QFontEngineXft( xftfs, result, 0 );
++ if (fp->paintdevice
++ && QPaintDeviceMetrics(fp->paintdevice).logicalDpiY() != QPaintDevice::x11AppDpiY()) {
++ double px;
++ XftPatternGetDouble(result, XFT_PIXEL_SIZE, 0, &px);
++ scale = request.pixelSize/px;
++ }
++ fe->setScale( scale );
++ fe->fontDef = request;
++ if ( script != QFont::Unicode && !canRender(fe, script) ) {
++ FM_DEBUG( " WARN: font loaded cannot render sample 0x%04x", ch );
++ delete fe;
++ fe = 0;
++ }
+ }
+- }
+- if (fe) {
+- QFontEngineXft *xft = (QFontEngineXft *)fe;
+- char *family;
+- if (XftPatternGetString(xft->pattern(), XFT_FAMILY, 0, &family) == XftResultMatch)
+- xft->fontDef.family = QString::fromUtf8(family);
++ if (fe) {
++ QFontEngineXft *xft = (QFontEngineXft *)fe;
++ char *family;
++ if (XftPatternGetString(xft->pattern(), XFT_FAMILY, 0, &family) == XftResultMatch)
++ xft->fontDef.family = QString::fromUtf8(family);
+
+- double px;
+- if (XftPatternGetDouble(xft->pattern(), XFT_PIXEL_SIZE, 0, &px) == XftResultMatch)
+- xft->fontDef.pixelSize = qRound(px);
++ double px;
++ if (XftPatternGetDouble(xft->pattern(), XFT_PIXEL_SIZE, 0, &px) == XftResultMatch)
++ xft->fontDef.pixelSize = qRound(px);
+
+- int weight = XFT_WEIGHT_MEDIUM;
+- XftPatternGetInteger(xft->pattern(), XFT_WEIGHT, 0, &weight);
+- xft->fontDef.weight = getXftWeight(weight);
++ int weight = XFT_WEIGHT_MEDIUM;
++ XftPatternGetInteger(xft->pattern(), XFT_WEIGHT, 0, &weight);
++ xft->fontDef.weight = getXftWeight(weight);
+
+- int slant = XFT_SLANT_ROMAN;
+- XftPatternGetInteger(xft->pattern(), XFT_SLANT, 0, &slant);
+- xft->fontDef.italic = (slant != XFT_SLANT_ROMAN);
++ int slant = XFT_SLANT_ROMAN;
++ XftPatternGetInteger(xft->pattern(), XFT_SLANT, 0, &slant);
++ xft->fontDef.italic = (slant != XFT_SLANT_ROMAN);
+
+- int spacing = XFT_PROPORTIONAL;
+- XftPatternGetInteger(xft->pattern(), XFT_SPACING, 0, &spacing);
+- xft->fontDef.fixedPitch = spacing != XFT_PROPORTIONAL;
++ int spacing = XFT_PROPORTIONAL;
++ XftPatternGetInteger(xft->pattern(), XFT_SPACING, 0, &spacing);
++ xft->fontDef.fixedPitch = spacing != XFT_PROPORTIONAL;
+
+- xft->fontDef.ignorePitch = FALSE;
+- break;
++ xft->fontDef.ignorePitch = FALSE;
++ break;
++ }
+ }
+- }
+- FcFontSetDestroy(fs);
++
++ if( use_fontsort )
++ FcFontSetDestroy(fs);
++ else
++ FcPatternDestroy(fsp);
++
++ if( fe )
++ break;
++
++ } // for( jj )
++
++ FcPatternDestroy(pattern);
++
+ return fe;
+ }
+
diff --git a/x11-toolkits/qt33/files/0067-nofclist.patch b/x11-toolkits/qt33/files/0067-nofclist.patch
new file mode 100644
index 000000000000..d5ac46a3730d
--- /dev/null
+++ b/x11-toolkits/qt33/files/0067-nofclist.patch
@@ -0,0 +1,378 @@
+qt-bugs@ issue : none yet
+bugs.kde.org number : none
+applied: no
+author: Lubos Lunak <l.lunak@kde.org>
+
+Instead of getting a full list of all fonts using XftFontList (which calls
+the still awfully slow FcFontList) load on-demand only info about fonts
+that are really needed.
+
+--- src/kernel/qfontdatabase.cpp.sav 2005-11-08 13:20:04.000000000 +0100
++++ src/kernel/qfontdatabase.cpp 2005-12-02 16:24:47.000000000 +0100
+@@ -996,6 +996,10 @@ QFontDatabase::findFont( QFont::Script s
+
+ load( family_name, script );
+
++ // With QT_XFT2 this iterates only those fonts for which load()
++ // has been already called, but that's ok, since below only
++ // those fonts with matching family name are used. If family
++ // name is empty, then load() loads all fonts.
+ for ( int x = 0; x < db->count; ++x ) {
+ QtFontFamily *try_family = db->families[x];
+ #ifdef Q_WS_X11
+--- src/kernel/qfontdatabase_x11.cpp.sav 2005-12-01 18:17:33.000000000 +0100
++++ src/kernel/qfontdatabase_x11.cpp 2005-12-02 16:27:34.000000000 +0100
+@@ -843,8 +843,92 @@ static void loadXft()
+ if (!qt_has_xft)
+ return;
+
+- XftFontSet *fonts;
++#ifdef QT_XFT2
++ struct XftDefaultFont {
++ const char *qtname;
++ const char *rawname;
++ bool fixed;
++ };
++ const XftDefaultFont defaults[] = {
++ { "Serif", "serif", FALSE },
++ { "Sans Serif", "sans-serif", FALSE },
++ { "Monospace", "monospace", TRUE },
++ { 0, 0, FALSE }
++ };
++ const XftDefaultFont *f = defaults;
++ while (f->qtname) {
++ QtFontFamily *family = db->family( f->qtname, TRUE );
++ family->rawName = f->rawname;
++ family->hasXft = TRUE;
++ family->synthetic = TRUE;
++ QtFontFoundry *foundry
++ = family->foundry( QString::null, TRUE );
++
++ for ( int i = 0; i < QFont::LastPrivateScript; ++i ) {
++ if (i == QFont::UnknownScript)
++ continue;
++ family->scripts[i] = QtFontFamily::Supported;
++ }
++
++ QtFontStyle::Key styleKey;
++ styleKey.oblique = FALSE;
++ for (int i = 0; i < 4; ++i) {
++ styleKey.italic = (i%2);
++ styleKey.weight = (i > 1) ? QFont::Bold : QFont::Normal;
++ QtFontStyle *style = foundry->style( styleKey, TRUE );
++ style->smoothScalable = TRUE;
++ QtFontSize *size = style->pixelSize( SMOOTH_SCALABLE, TRUE );
++ QtFontEncoding *enc = size->encodingID( -1, 0, 0, 0, 0, TRUE );
++ enc->pitch = (f->fixed ? 'm' : 'p');
++ }
++ ++f;
++ }
++#endif
++}
++
++#ifdef XFT_MATRIX
++static void checkXftMatrix( QtFontFamily* family ) {
++ for ( int j = 0; j < family->count; ++j ) { // each foundry
++ QtFontFoundry *foundry = family->foundries[j];
++ for ( int k = 0; k < foundry->count; ++k ) {
++ QtFontStyle *style = foundry->styles[k];
++ if ( style->key.italic || style->key.oblique ) continue;
+
++ QtFontSize *size = style->pixelSize( SMOOTH_SCALABLE );
++ if ( ! size ) continue;
++ QtFontEncoding *enc = size->encodingID( -1, 0, 0, 0, 0, TRUE );
++ if ( ! enc ) continue;
++
++ QtFontStyle::Key key = style->key;
++
++ // does this style have an italic equivalent?
++ key.italic = TRUE;
++ QtFontStyle *equiv = foundry->style( key );
++ if ( equiv ) continue;
++
++ // does this style have an oblique equivalent?
++ key.italic = FALSE;
++ key.oblique = TRUE;
++ equiv = foundry->style( key );
++ if ( equiv ) continue;
++
++ // let's fake one...
++ equiv = foundry->style( key, TRUE );
++ equiv->fakeOblique = TRUE;
++ equiv->smoothScalable = TRUE;
++
++ QtFontSize *equiv_size = equiv->pixelSize( SMOOTH_SCALABLE, TRUE );
++ QtFontEncoding *equiv_enc = equiv_size->encodingID( -1, 0, 0, 0, 0, TRUE );
++
++ // keep the same pitch
++ equiv_enc->pitch = enc->pitch;
++ }
++ }
++}
++#endif // XFT_MATRIX
++
++static bool loadXftFont( FcPattern* font )
++{
+ QString familyName;
+ QString rawName;
+ char *value;
+@@ -856,24 +940,9 @@ static void loadXft()
+ char *foundry_value = 0;
+ FcBool scalable = FcTrue;
+
+- fonts =
+- XftListFonts(QPaintDevice::x11AppDisplay(),
+- QPaintDevice::x11AppScreen(),
+- (const char *)0,
+- XFT_FAMILY, XFT_WEIGHT, XFT_SLANT,
+- XFT_SPACING, XFT_FILE, XFT_INDEX,
+-#ifdef QT_XFT2
+- FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
+-#if FC_VERSION >= 20193
+- FC_WIDTH,
+-#endif
+-#endif // QT_XFT2
+- (const char *)0);
+-
+- for (int i = 0; i < fonts->nfont; i++) {
+- if (XftPatternGetString(fonts->fonts[i],
++ if (XftPatternGetString( font,
+ XFT_FAMILY, 0, &value) != XftResultMatch )
+- continue;
++ return false;
+ // capitalize( value );
+ rawName = familyName = QString::fromUtf8(value);
+ familyName.replace('-', ' ');
+@@ -884,15 +953,15 @@ static void loadXft()
+ spacing_value = XFT_PROPORTIONAL;
+ file_value = 0;
+ index_value = 0;
+- XftPatternGetInteger (fonts->fonts[i], XFT_SLANT, 0, &slant_value);
+- XftPatternGetInteger (fonts->fonts[i], XFT_WEIGHT, 0, &weight_value);
+- XftPatternGetInteger (fonts->fonts[i], XFT_SPACING, 0, &spacing_value);
+- XftPatternGetString (fonts->fonts[i], XFT_FILE, 0, &file_value);
+- XftPatternGetInteger (fonts->fonts[i], XFT_INDEX, 0, &index_value);
++ XftPatternGetInteger (font, XFT_SLANT, 0, &slant_value);
++ XftPatternGetInteger (font, XFT_WEIGHT, 0, &weight_value);
++ XftPatternGetInteger (font, XFT_SPACING, 0, &spacing_value);
++ XftPatternGetString (font, XFT_FILE, 0, &file_value);
++ XftPatternGetInteger (font, XFT_INDEX, 0, &index_value);
+ #ifdef QT_XFT2
+- FcPatternGetBool(fonts->fonts[i], FC_SCALABLE, 0, &scalable);
++ FcPatternGetBool(font, FC_SCALABLE, 0, &scalable);
+ foundry_value = 0;
+- XftPatternGetString(fonts->fonts[i], FC_FOUNDRY, 0, &foundry_value);
++ XftPatternGetString(font, FC_FOUNDRY, 0, &foundry_value);
+ #endif
+ QtFontFamily *family = db->family( familyName, TRUE );
+ family->rawName = rawName;
+@@ -900,7 +969,7 @@ static void loadXft()
+
+ #ifdef QT_XFT2
+ FcCharSet *charset = 0;
+- FcResult res = FcPatternGetCharSet(fonts->fonts[i], FC_CHARSET, 0, &charset);
++ FcResult res = FcPatternGetCharSet(font, FC_CHARSET, 0, &charset);
+ if (res == FcResultMatch && FcCharSetCount(charset) > 1) {
+ for (int i = 0; i < QFont::LastPrivateScript; ++i) {
+ QChar ch = sampleCharacter((QFont::Script) i);
+@@ -934,7 +1003,7 @@ static void loadXft()
+ if (!scalable) {
+ int width = 100;
+ #if FC_VERSION >= 20193
+- XftPatternGetInteger (fonts->fonts[i], FC_WIDTH, 0, &width);
++ XftPatternGetInteger (font, FC_WIDTH, 0, &width);
+ #endif
+ styleKey.stretch = width;
+ }
+@@ -955,58 +1024,17 @@ static void loadXft()
+ #ifdef QT_XFT2
+ else {
+ double pixel_size = 0;
+- XftPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size);
++ XftPatternGetDouble (font, FC_PIXEL_SIZE, 0, &pixel_size);
+ size = style->pixelSize( (int)pixel_size, TRUE );
+ }
+ #endif
+ QtFontEncoding *enc = size->encodingID( -1, 0, 0, 0, 0, TRUE );
+ enc->pitch = ( spacing_value >= XFT_CHARCELL ? 'c' :
+ ( spacing_value >= XFT_MONO ? 'm' : 'p' ) );
+- }
+-
+- XftFontSetDestroy (fonts);
+-
+-#ifdef QT_XFT2
+- struct XftDefaultFont {
+- const char *qtname;
+- const char *rawname;
+- bool fixed;
+- };
+- const XftDefaultFont defaults[] = {
+- { "Serif", "serif", FALSE },
+- { "Sans Serif", "sans-serif", FALSE },
+- { "Monospace", "monospace", TRUE },
+- { 0, 0, FALSE }
+- };
+- const XftDefaultFont *f = defaults;
+- while (f->qtname) {
+- QtFontFamily *family = db->family( f->qtname, TRUE );
+- family->rawName = f->rawname;
+- family->hasXft = TRUE;
+- family->synthetic = TRUE;
+- QtFontFoundry *foundry
+- = family->foundry( QString::null, TRUE );
+-
+- for ( int i = 0; i < QFont::LastPrivateScript; ++i ) {
+- if (i == QFont::UnknownScript)
+- continue;
+- family->scripts[i] = QtFontFamily::Supported;
+- }
++
++ checkXftMatrix( family );
+
+- QtFontStyle::Key styleKey;
+- styleKey.oblique = FALSE;
+- for (int i = 0; i < 4; ++i) {
+- styleKey.italic = (i%2);
+- styleKey.weight = (i > 1) ? QFont::Bold : QFont::Normal;
+- QtFontStyle *style = foundry->style( styleKey, TRUE );
+- style->smoothScalable = TRUE;
+- QtFontSize *size = style->pixelSize( SMOOTH_SCALABLE, TRUE );
+- QtFontEncoding *enc = size->encodingID( -1, 0, 0, 0, 0, TRUE );
+- enc->pitch = (f->fixed ? 'm' : 'p');
+- }
+- ++f;
+- }
+-#endif
++ return true;
+ }
+
+ #ifndef QT_XFT2
+@@ -1231,17 +1259,39 @@ static inline void checkXftCoverage( QtF
+
+ static void load( const QString &family = QString::null, int script = -1 )
+ {
+-#ifdef QT_XFT2
+- if (qt_has_xft)
+- return;
+-#endif
+-
+ #ifdef QFONTDATABASE_DEBUG
+ QTime t;
+ t.start();
+ #endif
+
+ if ( family.isNull() ) {
++#ifndef QT_NO_XFTFREETYPE
++ static bool xft_readall_done = false;
++ if (qt_has_xft && !xft_readall_done) {
++ xft_readall_done = true;
++ XftFontSet *fonts =
++ XftListFonts(QPaintDevice::x11AppDisplay(),
++ QPaintDevice::x11AppScreen(),
++ (const char *)0,
++ XFT_FAMILY, XFT_WEIGHT, XFT_SLANT,
++ XFT_SPACING, XFT_FILE, XFT_INDEX,
++#ifdef QT_XFT2
++ FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
++#if FC_VERSION >= 20193
++ FC_WIDTH,
++#endif
++#endif // QT_XFT2
++ (const char *)0);
++ for (int i = 0; i < fonts->nfont; i++) {
++ loadXftFont( fonts->fonts[i] );
++ }
++ XftFontSetDestroy (fonts);
++ }
++#ifdef QT_XFT2
++ if (qt_has_xft)
++ return;
++#endif
++#endif // QT_NO_XFTFREETYPE
+ if ( script == -1 )
+ loadXlfds( 0, -1 );
+ else {
+@@ -1254,12 +1304,38 @@ static void load( const QString &family
+ QtFontFamily *f = db->family( family, TRUE );
+ if ( !f->fullyLoaded ) {
+
+-#if !defined(QT_NO_XFTFREETYPE) && !defined(QT_XFT2)
++#ifndef QT_NO_XFTFREETYPE
++ if (qt_has_xft) {
++ XftFontSet *fonts =
++ XftListFonts(QPaintDevice::x11AppDisplay(),
++ QPaintDevice::x11AppScreen(),
++ XFT_FAMILY, XftTypeString, family.utf8().data(),
++ (const char *)0,
++ XFT_FAMILY, XFT_WEIGHT, XFT_SLANT,
++ XFT_SPACING, XFT_FILE, XFT_INDEX,
++#ifdef QT_XFT2
++ FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
++#if FC_VERSION >= 20193
++ FC_WIDTH,
++#endif
++#endif // QT_XFT2
++ (const char *)0);
++ for (int i = 0; i < fonts->nfont; i++) {
++ loadXftFont( fonts->fonts[i] );
++ }
++ XftFontSetDestroy (fonts);
++ f->fullyLoaded = TRUE;
++#ifdef QT_XFT2
++ return;
++#endif
++ }
++#ifndef QT_XFT2
+ // need to check Xft coverage
+ if ( f->hasXft && !f->xftScriptCheck ) {
+ checkXftCoverage( f );
+ }
+ #endif
++#endif // QT_NO_XFTFREETYPE
+ // could reduce this further with some more magic:
+ // would need to remember the encodings loaded for the family.
+ if ( ( script == -1 && !f->xlfdLoaded ) ||
+@@ -1305,42 +1381,7 @@ static void initializeDb()
+ #endif // QT_XFT2
+
+ #ifdef XFT_MATRIX
+- for ( int j = 0; j < db->families[i]->count; ++j ) { // each foundry
+- QtFontFoundry *foundry = db->families[i]->foundries[j];
+- for ( int k = 0; k < foundry->count; ++k ) {
+- QtFontStyle *style = foundry->styles[k];
+- if ( style->key.italic || style->key.oblique ) continue;
+-
+- QtFontSize *size = style->pixelSize( SMOOTH_SCALABLE );
+- if ( ! size ) continue;
+- QtFontEncoding *enc = size->encodingID( -1, 0, 0, 0, 0, TRUE );
+- if ( ! enc ) continue;
+-
+- QtFontStyle::Key key = style->key;
+-
+- // does this style have an italic equivalent?
+- key.italic = TRUE;
+- QtFontStyle *equiv = foundry->style( key );
+- if ( equiv ) continue;
+-
+- // does this style have an oblique equivalent?
+- key.italic = FALSE;
+- key.oblique = TRUE;
+- equiv = foundry->style( key );
+- if ( equiv ) continue;
+-
+- // let's fake one...
+- equiv = foundry->style( key, TRUE );
+- equiv->fakeOblique = TRUE;
+- equiv->smoothScalable = TRUE;
+-
+- QtFontSize *equiv_size = equiv->pixelSize( SMOOTH_SCALABLE, TRUE );
+- QtFontEncoding *equiv_enc = equiv_size->encodingID( -1, 0, 0, 0, 0, TRUE );
+-
+- // keep the same pitch
+- equiv_enc->pitch = enc->pitch;
+- }
+- }
++ checkXftMatrix( db->families[i] );
+ #endif // XFT_MATRIX
+ }
+ #endif