diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-02 21:21:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-02 21:21:15 +0000 |
commit | 96900dbce3aaa1fcac74a07a71482c5c6fcd3cab (patch) | |
tree | bf3fc68d0dcc660fce0e21171373a2d4e2395707 /kdeui/kactionclasses.cpp | |
parent | 5f99bff82d3413803bcc652999f4f631058179d6 (diff) | |
download | tdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.tar.gz tdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.zip |
* Large set of SuSE patches to fix bugs and add functionality
* kdemm is included but not used by knotify as it does not work out of the box
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/kactionclasses.cpp')
-rw-r--r-- | kdeui/kactionclasses.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/kdeui/kactionclasses.cpp b/kdeui/kactionclasses.cpp index 1fa7223cb..113ef2ea0 100644 --- a/kdeui/kactionclasses.cpp +++ b/kdeui/kactionclasses.cpp @@ -27,6 +27,9 @@ #include "kactionclasses.h" #include <assert.h> +#include <ft2build.h> +#include FT_FREETYPE_H +#include <fontconfig/fontconfig.h> #include <tqcursor.h> #include <tqclipboard.h> @@ -35,6 +38,7 @@ #include <tqwhatsthis.h> #include <tqtimer.h> #include <tqfile.h> +#include <tqregexp.h> #include <dcopclient.h> #include <dcopref.h> @@ -1498,7 +1502,24 @@ void KFontAction::setFont( const TQString &family ) 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; + TQString realFamily; + TQRegExp 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( TQWidget *w, int index ) |