Sophie

Sophie

distrib > Mandriva > cs4.0 > i586 > by-pkgid > fa9b6a46c8aad7f4f199c98596a0ec2a > files > 21

kdelibs-3.5.4-1.1.20060mlcs4.src.rpm

--- kdelibs-3.5.1/kdeui/kaction.cpp	2005-09-29 06:47:40.000000000 -0300
+++ kdelibs-3.5.1/kdeui/kaction.cpp.new	2006-01-31 14:07:29.000000000 -0200
@@ -42,6 +42,17 @@
 #include <ktoolbar.h>
 #include <ktoolbarbutton.h>
 
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <X11/Xdefs.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include <X11/Xft/Xft.h>
+
 /**
 * How it works.
 * KActionCollection is an organizing container for KActions.
--- kdelibs-3.5.1/kdeui/Makefile.am	2005-09-29 06:47:40.000000000 -0300
+++ kdelibs-3.5.1/kdeui/Makefile.am.new	2006-01-31 14:06:12.000000000 -0200
@@ -20,7 +20,7 @@
 
 SUBDIRS = . kdetrayproxy tests about
 
-INCLUDES= -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
+INCLUDES= -I/usr/include/freetype2 -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
 
 # For the future: examine if condensing the tons of *_LDFLAGS variables
 # into $(all_libraries) isn't better
--- kdelibs-3.5.1/kdeui/kfontcombo.cpp	2005-09-29 06:47:40.000000000 -0300
+++ kdelibs-3.5.1/kdeui/kfontcombo.cpp.new	2006-01-31 14:12:34.000000000 -0200
@@ -20,6 +20,7 @@
 #include <qfontdatabase.h>
 #include <qlistbox.h>
 #include <qpainter.h>
+#include <qregexp.h>
 
 #include <kcharsets.h>
 #include <kconfig.h>
@@ -29,6 +30,18 @@
 #include "kfontcombo.h"
 #include "kfontcombo.moc"
 
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <fontconfig/fontconfig.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include <X11/Xft/Xft.h>
+
+
 struct KFontComboPrivate
 {
     KFontComboPrivate()
@@ -216,6 +229,24 @@
        }
     }
 
+
+    // nothing matched yet, try a fontconfig reverse lookup and
+    // check again to solve an alias
+    FcPattern *pattern = NULL;
+    FcConfig *config = NULL;
+    QString realFamily;
+    QRegExp regExp("[-:]");
+    pattern = FcNameParse( (unsigned char*) family.ascii() );
+    FcDefaultSubstitute(pattern);
+    FcConfigSubstitute (config, pattern, FcMatchPattern);
+    pattern = FcFontMatch(NULL, pattern, NULL);
+    realFamily = (char*)FcNameUnparse(pattern);
+    realFamily.remove(realFamily.find(regExp), realFamily.length());
+
+    if ( !realFamily.isEmpty() && realFamily != family )
+       setCurrentFont( realFamily );
+
+    
     lowerName += " [";
     for(int i = 0; i < c; i++)
     {
--- kdelibs-3.5.1/kdeui/kactionclasses.cpp	2006-01-25 13:58:02.000000000 -0200
+++ kdelibs-3.5.1/kdeui/kactionclasses.cpp.new	2006-01-31 14:09:43.000000000 -0200
@@ -28,6 +28,10 @@
 
 #include <assert.h>
 
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <fontconfig/fontconfig.h>
+
 #include <qcursor.h>
 #include <qclipboard.h>
 #include <qfontdatabase.h>
@@ -35,6 +39,7 @@
 #include <qwhatsthis.h>
 #include <qtimer.h>
 #include <qfile.h>
+#include <qregexp.h>
 
 #include <dcopclient.h>
 #include <dcopref.h>
@@ -1502,7 +1507,26 @@
           return;
        }
     }
-    kdDebug(129) << "Font not found " << family.lower() << endl;
+
+    // nothing matched yet, try a fontconfig reverse lookup and
+    // check again to solve an alias
+    FcPattern *pattern = NULL;
+    FcConfig *config = NULL;
+    QString realFamily;
+    QRegExp regExp("[-:]");
+    pattern = FcNameParse( (unsigned char*) family.ascii() );
+    FcDefaultSubstitute(pattern);
+    FcConfigSubstitute (config, pattern, FcMatchPattern);
+    pattern = FcFontMatch(NULL, pattern, NULL);
+    realFamily = (char*)FcNameUnparse(pattern);
+    realFamily.remove(realFamily.find(regExp), realFamily.length());
+
+    if ( !realFamily.isEmpty() && realFamily != family )
+       setFont( realFamily );
+    else
+       kdDebug(129) << "Font not found " << family.lower() << endl;
+
+    
 }
 
 int KFontAction::plug( QWidget *w, int index )