]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
bugfix recent font additions
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 May 2010 22:50:34 +0000 (22:50 +0000)
committervortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 May 2010 22:50:34 +0000 (22:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10213 d7cf8633-e32d-0410-b094-e92efae38249

ft2.c
gl_draw.c

diff --git a/ft2.c b/ft2.c
index 99dff819cddf0d6518b9d50f220569cfa6ec7f1b..6b9152c17116b9aa70a32053e35c637e478e383a 100644 (file)
--- 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)
index 9a3544f89fddb635fc54b8462004473dbde6bd23..1a7785ec9118637b321ce1766587b8063b70689c 100644 (file)
--- 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