Do not assume fontconfig will find a font.

If you have no fonts in fontconfig, it returns NULL... believe me, it
does happen.



SVN revision: 36029
This commit is contained in:
Gustavo Sverzut Barbieri 2008-09-16 22:59:59 +00:00
parent b85bedb940
commit 6c918f3d8a
1 changed files with 6 additions and 0 deletions

View File

@ -322,6 +322,11 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
/* do matching */
set = FcFontSort(NULL, p_nm, FcTrue, NULL, &res);
if (!set)
{
fprintf(stderr, "ERROR: no fontconfig font matches '%s'. It was the last resource, no font found!\n", name);
goto fc_end;
}
/* Do loading for all in family */
for (i = 0; i < set->nfont; i++)
@ -337,6 +342,7 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
}
FcFontSetDestroy(set);
fc_end:
FcPatternDestroy(p_nm);
}
#endif