Fix crashes with fontconfig 2.9.0 and newer

This resolves Bug 1422
pull/16/head
Slávek Banko 12 years ago
parent 7d6a98f9b3
commit 513dce7c02

@ -1506,12 +1506,13 @@ void TDEFontAction::setFont( const TQString &family )
// check again to solve an alias // check again to solve an alias
FcPattern *pattern = NULL; FcPattern *pattern = NULL;
FcConfig *config = NULL; FcConfig *config = NULL;
FcResult result;
TQString realFamily; TQString realFamily;
TQRegExp regExp("[-:]"); TQRegExp regExp("[-:]");
pattern = FcNameParse( (unsigned char*) family.ascii() ); pattern = FcNameParse( (unsigned char*) family.ascii() );
FcDefaultSubstitute(pattern); FcDefaultSubstitute(pattern);
FcConfigSubstitute (config, pattern, FcMatchPattern); FcConfigSubstitute (config, pattern, FcMatchPattern);
pattern = FcFontMatch(NULL, pattern, NULL); pattern = FcFontMatch(NULL, pattern, &result);
realFamily = (char*)FcNameUnparse(pattern); realFamily = (char*)FcNameUnparse(pattern);
realFamily.remove(realFamily.find(regExp), realFamily.length()); realFamily.remove(realFamily.find(regExp), realFamily.length());

@ -244,12 +244,13 @@ void TDEFontCombo::setCurrentFont(const TQString &family)
// check again to solve an alias // check again to solve an alias
FcPattern *pattern = NULL; FcPattern *pattern = NULL;
FcConfig *config = NULL; FcConfig *config = NULL;
FcResult result;
TQString realFamily; TQString realFamily;
TQRegExp regExp("[-:]"); TQRegExp regExp("[-:]");
pattern = FcNameParse( (unsigned char*) family.ascii() ); pattern = FcNameParse( (unsigned char*) family.ascii() );
FcDefaultSubstitute(pattern); FcDefaultSubstitute(pattern);
FcConfigSubstitute (config, pattern, FcMatchPattern); FcConfigSubstitute (config, pattern, FcMatchPattern);
pattern = FcFontMatch(NULL, pattern, NULL); pattern = FcFontMatch(NULL, pattern, &result);
realFamily = (char*)FcNameUnparse(pattern); realFamily = (char*)FcNameUnparse(pattern);
realFamily.remove(realFamily.find(regExp), realFamily.length()); realFamily.remove(realFamily.find(regExp), realFamily.length());

Loading…
Cancel
Save