From e01b6fe3d09bf6f4f57729cb5d0c3460ac426839 Mon Sep 17 00:00:00 2001 From: vortex Date: Sat, 22 May 2010 22:50:34 +0000 Subject: [PATCH] bugfix recent font additions git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10213 d7cf8633-e32d-0410-b094-e92efae38249 --- ft2.c | 2 +- gl_draw.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ft2.c b/ft2.c index 99dff819..6b9152c1 100644 --- a/ft2.c +++ b/ft2.c @@ -465,7 +465,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti namelen = strlen(name); // try load direct file - memcpy(filename, name, namelen); + memcpy(filename, name, namelen+1); data = FS_LoadFile(filename, font_mempool, false, &datasize); // try load .ttf if (!data) diff --git a/gl_draw.c b/gl_draw.c index 9a3544f8..1a7785ec 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ft2_fontdefs.h" dp_fonts_t dp_fonts; +static mempool_t *fonts_mempool = NULL; cvar_t r_textshadow = {CVAR_SAVE, "r_textshadow", "0", "draws a shadow on all text to improve readability (note: value controls offset, 1 = 1 pixel, 1.5 = 1.5 pixels, etc)"}; cvar_t r_textbrightness = {CVAR_SAVE, "r_textbrightness", "0", "additional brightness for text color codes (0 keeps colors as is, 1 makes them all white)"}; @@ -712,7 +713,7 @@ dp_font_t *FindFont(const char *title, qboolean allocate_new) dp_fonts.maxsize = dp_fonts.maxsize + FONTS_EXPAND; if (developer_font.integer) Con_Printf("FindFont: enlarging fonts buffer (%i -> %i)\n", i, dp_fonts.maxsize); - dp_fonts.f = Mem_Realloc(tempmempool, dp_fonts.f, sizeof(dp_font_t) * dp_fonts.maxsize); + dp_fonts.f = Mem_Realloc(fonts_mempool, dp_fonts.f, sizeof(dp_font_t) * dp_fonts.maxsize); // register a font in first expanded slot strlcpy(dp_fonts.f[i].title, title, sizeof(dp_fonts.f[i].title)); return &dp_fonts.f[i]; @@ -906,8 +907,9 @@ void GL_Draw_Init (void) Cvar_RegisterVariable(&r_textcontrast); // allocate fonts storage + fonts_mempool = Mem_AllocPool("FONTS", 0, NULL); dp_fonts.maxsize = MAX_FONTS; - dp_fonts.f = Mem_Alloc(tempmempool, sizeof(dp_font_t) * dp_fonts.maxsize); + dp_fonts.f = Mem_Alloc(fonts_mempool, sizeof(dp_font_t) * dp_fonts.maxsize); memset(dp_fonts.f, 0, sizeof(dp_font_t) * dp_fonts.maxsize); // assign starting font names -- 2.39.2