FcInitReinitialize(); // FcInitBringUptoDate did not seem to reload config file as was still getting old default font.
FcPattern* matchPattern = FcPatternCreate();
- FcConfigSubstitute(NULL, matchPattern, FcMatchPattern);
- FcDefaultSubstitute( matchPattern );
- MatchFontDescriptionToPattern( matchPattern, mDefaultFontDescription );
- FcPatternDestroy( matchPattern );
+ if( matchPattern )
+ {
+ FcConfigSubstitute( NULL, matchPattern, FcMatchPattern );
+ FcDefaultSubstitute( matchPattern );
+
+ MatchFontDescriptionToPattern( matchPattern, mDefaultFontDescription );
+ FcPatternDestroy( matchPattern );
+ }
mDefaultFontDescriptionCached = true;
}
// a pattern holds a set of names, each name refers to a property of the font
FcPattern* fontFamilyPattern = FcPatternCreate();
+ if( !fontFamilyPattern )
+ {
+ return NULL;
+ }
+
// add a property to the pattern for the font family
FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontDescription.family.c_str() ) );