Mac OS X font loading fix: Skip over system font "AppleMyungjo.ttf" which causes TTF_OpenFont() to crash.

This commit is contained in:
Martin Fuhrer 2008-02-07 04:11:04 +00:00
parent e808a05183
commit 1bd1c7233f

View file

@ -31,6 +31,12 @@
#ifdef __APPLE__
#include "wrapperdata.h"
extern WrapperData macosx;
/* system fonts that cause TTF_OpenFont to crash */
static const char* problemFonts[] = {
"/Library/Fonts//AppleMyungjo.ttf",
NULL
};
#endif
#ifdef FORKED_FONTS
@ -284,9 +290,19 @@ TuxPaint_Font * TuxPaint_Font_OpenFont(const char * pangodesc, const char * ttff
if (ttffilename != NULL && ttffilename[0] != '\0')
{
int i;
#ifdef DEBUG
printf("Opening TTF\n"); fflush(stdout);
#endif
#ifdef __APPLE__
i = 0;
while (problemFonts[i] != NULL)
{
if (!strcmp(ttffilename, problemFonts[i++]))
return NULL; /* bail on known problematic fonts that cause TTF_OpenFont to crash */
}
#endif
tpf = (TuxPaint_Font *) malloc(sizeof(TuxPaint_Font));
tpf->typ = FONT_TYPE_TTF;