From 96900dbce3aaa1fcac74a07a71482c5c6fcd3cab Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 2 Sep 2010 21:21:15 +0000 Subject: * 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 --- kdeui/kactionclasses.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'kdeui/kactionclasses.cpp') 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 +#include +#include FT_FREETYPE_H +#include #include #include @@ -35,6 +38,7 @@ #include #include #include +#include #include #include @@ -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 ) -- cgit v1.2.1