mirror of https://github.com/fltk/fltk
Avoid crash when XftFontOpenPattern() returns NULL.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10175 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
1cd5e78946
commit
67f3c4cc82
|
@ -270,7 +270,10 @@ static XftFont* fontopen(const char* name, Fl_Fontsize size, bool core, int angl
|
|||
free(picked_name);
|
||||
#endif
|
||||
|
||||
if (!match_pat) {
|
||||
// open the matched font
|
||||
if (match_pat) the_font = XftFontOpenPattern(fl_display, match_pat);
|
||||
|
||||
if (!match_pat || !the_font) {
|
||||
// last chance, just open any font in the right size
|
||||
the_font = XftFontOpen (fl_display, fl_screen,
|
||||
XFT_FAMILY, XftTypeString, "sans",
|
||||
|
@ -284,9 +287,6 @@ static XftFont* fontopen(const char* name, Fl_Fontsize size, bool core, int angl
|
|||
return the_font;
|
||||
}
|
||||
|
||||
// open the matched font
|
||||
the_font = XftFontOpenPattern(fl_display, match_pat);
|
||||
|
||||
#if 0 // diagnostic to print the "full name" of the font we actually opened. This works.
|
||||
FcChar8 *picked_name2 = FcNameUnparse(the_font->pattern);
|
||||
printf("Open : %s\n", picked_name2);
|
||||
|
|
Loading…
Reference in New Issue