Properly release glyph TextureData;
@@ -58,6 +58,12 @@ void lovrFontDestroy(void* ref) {
Font* font = ref;
lovrRelease(font->rasterizer);
lovrRelease(font->texture);
+ const char* key;
+ map_iter_t iter = map_iter(&font->atlas.glyphs);
+ while ((key = map_next(&font->atlas.glyphs, &iter)) != NULL) {
+ Glyph* glyph = map_get(&font->atlas.glyphs, key);
+ lovrRelease(glyph->data);
+ }
map_deinit(&font->atlas.glyphs);
map_deinit(&font->kerning);
free(font);
@@ -320,8 +326,7 @@ void lovrFontCreateTexture(Font* font) {
}
TextureData* textureData = lovrTextureDataGetBlank(font->atlas.width, font->atlas.height, 0x0, FORMAT_RGB);
- TextureFilter filter = { .mode = FILTER_BILINEAR };
font->texture = lovrTextureCreate(TEXTURE_2D, &textureData, 1, false, false);
- lovrTextureSetFilter(font->texture, filter);
+ lovrTextureSetFilter(font->texture, (TextureFilter) { .mode = FILTER_BILINEAR });
lovrTextureSetWrap(font->texture, (TextureWrap) { .s = WRAP_CLAMP, .t = WRAP_CLAMP });
}
