Mac OS X font loading fix: Skip over system font "AppleMyungjo.ttf" which causes TTF_OpenFont() to crash.
This commit is contained in:
parent
e808a05183
commit
1bd1c7233f
1 changed files with 16 additions and 0 deletions
16
src/fonts.c
16
src/fonts.c
|
|
@ -31,6 +31,12 @@
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "wrapperdata.h"
|
#include "wrapperdata.h"
|
||||||
extern WrapperData macosx;
|
extern WrapperData macosx;
|
||||||
|
|
||||||
|
/* system fonts that cause TTF_OpenFont to crash */
|
||||||
|
static const char* problemFonts[] = {
|
||||||
|
"/Library/Fonts//AppleMyungjo.ttf",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
|
|
@ -284,9 +290,19 @@ TuxPaint_Font * TuxPaint_Font_OpenFont(const char * pangodesc, const char * ttff
|
||||||
|
|
||||||
if (ttffilename != NULL && ttffilename[0] != '\0')
|
if (ttffilename != NULL && ttffilename[0] != '\0')
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Opening TTF\n"); fflush(stdout);
|
printf("Opening TTF\n"); fflush(stdout);
|
||||||
#endif
|
#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 = (TuxPaint_Font *) malloc(sizeof(TuxPaint_Font));
|
||||||
tpf->typ = FONT_TYPE_TTF;
|
tpf->typ = FONT_TYPE_TTF;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue