]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Store the data pointer and free it on Font_UnloadFont
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Nov 2010 18:40:47 +0000 (18:40 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Nov 2010 18:40:47 +0000 (18:40 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10588 d7cf8633-e32d-0410-b094-e92efae38249

ft2.c
ft2.h

diff --git a/ft2.c b/ft2.c
index f5efcabbe30fb94465342df445ed522b4ccf499b..47958d74312de44e2af10f8baea9c7558331fcde 100644 (file)
--- a/ft2.c
+++ b/ft2.c
@@ -510,6 +510,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti
                _face = 0;
                status = qFT_New_Memory_Face(font_ft2lib, (FT_Bytes)data, datasize, 0, (FT_Face*)&font->face);
        }
+       font->data = data;
        if (status)
        {
                Con_Printf("ERROR: can't create face for %s\n"
@@ -981,6 +982,10 @@ void Font_UnloadFont(ft2_font_t *font)
                        font->face = NULL;
                }
        }
+       if (font->data) {
+           Mem_Free(font->data);
+           font->data = NULL;
+       }
 }
 
 static float Font_SearchSize(ft2_font_t *font, FT_Face fontface, float size)
diff --git a/ft2.h b/ft2.h
index b8d8cd5c87f192da0d9c35dc0de2330d79bca66c..78728c2dfd18778a164728f400578c32d1275693 100644 (file)
--- a/ft2.h
+++ b/ft2.h
@@ -43,7 +43,7 @@ typedef struct ft2_font_s
 
        // TODO: clean this up and do not expose everything.
        
-       //unsigned char  *data;
+       unsigned char  *data; // TODO: See if FT2 actually needs it to stay... probably does
        //fs_offset_t     datasize;
        void           *face;