mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
------------------------------------------------------------------------
r4185 | acceptthis | 2013-01-29 03:23:49 +0000 (Tue, 29 Jan 2013) | 1 line one fix for messed up fonts occasionally. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4183 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
118b5df52b
commit
be21617b87
1 changed files with 9 additions and 3 deletions
|
@ -147,7 +147,7 @@ static const char *imgs[] =
|
|||
};
|
||||
|
||||
#define FONTCHARS (1<<16)
|
||||
#define FONTPLANES 1//(1<<2) //this is total, not per font.
|
||||
#define FONTPLANES (1<<2) //this is total, not per font.
|
||||
#define PLANEIDXTYPE unsigned short
|
||||
#define CHARIDXTYPE unsigned short
|
||||
|
||||
|
@ -182,6 +182,7 @@ typedef struct font_s
|
|||
short top;
|
||||
short left;
|
||||
} chars[FONTCHARS];
|
||||
char name[64];
|
||||
|
||||
short charheight;
|
||||
texid_t singletexture;
|
||||
|
@ -941,6 +942,7 @@ struct font_s *Font_LoadFont(int vheight, char *fontfilename)
|
|||
|
||||
f = Z_Malloc(sizeof(*f));
|
||||
f->charheight = height;
|
||||
Q_strncpyz(f->name, fontfilename, sizeof(f->name));
|
||||
|
||||
#ifdef DOOMWADS
|
||||
if (!*fontfilename)
|
||||
|
@ -1132,7 +1134,7 @@ struct font_s *Font_LoadFont(int vheight, char *fontfilename)
|
|||
//removes a font from memory.
|
||||
void Font_Free(struct font_s *f)
|
||||
{
|
||||
struct charcache_s **link, *c;
|
||||
struct charcache_s **link, *c, *valid;
|
||||
|
||||
//kill the alt font first.
|
||||
if (f->alt)
|
||||
|
@ -1140,6 +1142,7 @@ void Font_Free(struct font_s *f)
|
|||
Font_Free(f->alt);
|
||||
f->alt = NULL;
|
||||
}
|
||||
valid = NULL;
|
||||
//walk all chars, unlinking any that appear to be within this font's char cache
|
||||
for (link = &fontplanes.oldestchar; *link; )
|
||||
{
|
||||
|
@ -1148,12 +1151,15 @@ void Font_Free(struct font_s *f)
|
|||
{
|
||||
c = c->nextchar;
|
||||
if (!c)
|
||||
fontplanes.newestchar = NULL;
|
||||
fontplanes.newestchar = valid;
|
||||
*link = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = c;
|
||||
link = &c->nextchar;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AVAIL_FREETYPE
|
||||
if (f->face)
|
||||
|
|
Loading…
Reference in a new issue