[pkg-kde-commits] rev 2678 - in trunk/packages/qt-x11-free/debian: . patches

Christopher Martin chrsmrtn at costa.debian.org
Mon Dec 19 19:10:26 UTC 2005


Author: chrsmrtn
Date: 2005-12-19 19:10:25 +0000 (Mon, 19 Dec 2005)
New Revision: 2678

Added:
   trunk/packages/qt-x11-free/debian/patches/41_fcsort2fcmatch.dpatch
   trunk/packages/qt-x11-free/debian/patches/42_nofclist.dpatch
Modified:
   trunk/packages/qt-x11-free/debian/changelog
   trunk/packages/qt-x11-free/debian/patches/00list
Log:
Add new font-related Qt optimizations from qt-copy.

Still young and experimental, but if they prove safe, great.


Modified: trunk/packages/qt-x11-free/debian/changelog
===================================================================
--- trunk/packages/qt-x11-free/debian/changelog	2005-12-19 17:51:03 UTC (rev 2677)
+++ trunk/packages/qt-x11-free/debian/changelog	2005-12-19 19:10:25 UTC (rev 2678)
@@ -1,3 +1,13 @@
+qt-x11-free (3:3.3.5-4) UNRELEASED; urgency=low
+
+  +++ Changes by Christopher Martin:
+
+  * Add patches from qt-copy which improve font performance dramatically.
+
+  * Change build-depends from libmysqlclient12-dev to libmysqlclient15-dev.
+
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Date
+
 qt-x11-free (3:3.3.5-3) unstable; urgency=low
 
   +++ Changes by Christopher Martin:

Modified: trunk/packages/qt-x11-free/debian/patches/00list
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/00list	2005-12-19 17:51:03 UTC (rev 2677)
+++ trunk/packages/qt-x11-free/debian/patches/00list	2005-12-19 19:10:25 UTC (rev 2678)
@@ -30,3 +30,5 @@
 38_qtc_khotkeys_input_84434
 39_qtc_qpopup_has_mouse
 40_qtc_qpopup_ignore_mousepos
+41_fcsort2fcmatch
+42_nofclist

Added: trunk/packages/qt-x11-free/debian/patches/41_fcsort2fcmatch.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/41_fcsort2fcmatch.dpatch	2005-12-19 17:51:03 UTC (rev 2677)
+++ trunk/packages/qt-x11-free/debian/patches/41_fcsort2fcmatch.dpatch	2005-12-19 19:10:25 UTC (rev 2678)
@@ -0,0 +1,246 @@
+#! /bin/sh -e
+# Qt-Copy patch #66
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+--- qt.orig/src/kernel/qfontdatabase_x11.cpp
++++ qt.patched/src/kernel/qfontdatabase_x11.cpp
+@@ -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;
+ }
+ 

Added: trunk/packages/qt-x11-free/debian/patches/42_nofclist.dpatch
===================================================================
--- trunk/packages/qt-x11-free/debian/patches/42_nofclist.dpatch	2005-12-19 17:51:03 UTC (rev 2677)
+++ trunk/packages/qt-x11-free/debian/patches/42_nofclist.dpatch	2005-12-19 19:10:25 UTC (rev 2678)
@@ -0,0 +1,391 @@
+#! /bin/sh -e
+# Qt-Copy patch #67
+
+if [ $# -lt 1 ]; then
+    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+    exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+    -patch) patch -p1 ${patch_opts} < $0;;
+    -unpatch) patch -R -p1 ${patch_opts} < $0;;
+    *)
+        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+        exit 1;;
+esac
+
+exit 0
+
+ at DPATCH@
+--- qt.orig/src/kernel/qfontdatabase.cpp
++++ qt.patched/src/kernel/qfontdatabase.cpp
+@@ -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
+--- qt.orig/src/kernel/qfontdatabase_x11.cpp
++++ qt.patched/src/kernel/qfontdatabase_x11.cpp
+@@ -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




More information about the pkg-kde-commits mailing list