Ignoring ".pfb" (PostScript 'Printer Font Binary') fonts, to avoid crashes.
This commit is contained in:
parent
913275e144
commit
40a1221114
2 changed files with 19 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ http://www.tuxpaint.org/
|
|||
|
||||
$Id$
|
||||
|
||||
2014.April.16 (0.9.22)
|
||||
2014.April.19 (0.9.22)
|
||||
|
||||
* New Tools:
|
||||
----------
|
||||
|
|
@ -623,6 +623,9 @@ $Id$
|
|||
* Saved images woose path contains non-ascii chars can now be opened on Windows.
|
||||
Fixes http://sourceforge.net/p/tuxpaint/bugs/188/
|
||||
|
||||
* Ignoring ".pfb" (PostScript 'Printer Font Binary') fonts, to
|
||||
avoid crashes.
|
||||
|
||||
2009.June.28 (0.9.21)
|
||||
* New Starters:
|
||||
-------------
|
||||
|
|
|
|||
16
src/fonts.c
16
src/fonts.c
|
|
@ -83,6 +83,12 @@ static const char *problemFonts[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
/* font types that cause TTF_OpenFont to crash */
|
||||
static const char *problemFontExtensions[] = {
|
||||
".pfb", /* Ubuntu 14.04 (libsdl-ttf2.0-0 2.0.11-3, libfreetype6 2.5.2-1ubuntu2) -bjk 2014.04.19 */
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef FORKED_FONTS
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
|
@ -270,7 +276,7 @@ void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
|||
TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffilename, int size)
|
||||
{
|
||||
TuxPaint_Font *tpf = NULL;
|
||||
int i = 0;
|
||||
int i;
|
||||
#ifndef NO_SDLPANGO
|
||||
char desc[1024];
|
||||
#endif
|
||||
|
|
@ -320,12 +326,20 @@ TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffile
|
|||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
while (problemFonts[i] != NULL)
|
||||
{
|
||||
if (!strcmp(ttffilename, problemFonts[i++]))
|
||||
return NULL; /* bail on known problematic fonts that cause TTF_OpenFont to crash */
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (problemFontExtensions[i] != NULL)
|
||||
{
|
||||
if (strstr(ttffilename, problemFontExtensions[i++]))
|
||||
return NULL; /* bail on known problematic font types that cause TTF_OpenFont to crash */
|
||||
}
|
||||
|
||||
tpf = (TuxPaint_Font *) malloc(sizeof(TuxPaint_Font));
|
||||
tpf->typ = FONT_TYPE_TTF;
|
||||
tpf->ttf_font = TTF_OpenFont(ttffilename, size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue