Fix crashes with fontconfig 2.9.0 and newer

This resolves Bug 1422
(cherry picked from commit 513dce7c02)
v3.5.13-sru
Slávek Banko 12 years ago
parent 9a034a7c47
commit a480a76fad

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

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

Loading…
Cancel
Save