summaryrefslogtreecommitdiff
path: root/x11-toolkits/qt33/files/0067-nofclist.patch
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/0067-nofclist.patch
parent- Update to 2.0.11 (diff)
Update to KDE 3.5.0
Notes
Notes: svn path=/head/; revision=153084
Diffstat (limited to 'x11-toolkits/qt33/files/0067-nofclist.patch')
-rw-r--r--x11-toolkits/qt33/files/0067-nofclist.patch378
1 files changed, 378 insertions, 0 deletions
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