]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - ft2.c
change default snd_soundradius back to 1000, matching Quake
[xonotic/darkplaces.git] / ft2.c
diff --git a/ft2.c b/ft2.c
index f5efcabbe30fb94465342df445ed522b4ccf499b..217029668d0ab82d2b189c6c97874d952fdf9f47 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"
@@ -955,9 +956,14 @@ static void UnloadMapRec(ft2_font_map_t *map)
 void Font_UnloadFont(ft2_font_t *font)
 {
        int i;
+
+       // unload fallbacks
+       if(font->next)
+               Font_UnloadFont(font->next);
+
        if (font->attachments && font->attachmentcount)
        {
-               for (i = 0; i < font->attachmentcount; ++i) {
+               for (i = 0; i < (int)font->attachmentcount; ++i) {
                        if (font->attachments[i].data)
                                Mem_Free(font->attachments[i].data);
                }
@@ -981,6 +987,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)