impr: Drastically reduce font-related memory usage

This commit is contained in:
WerWolv
2025-02-10 12:02:05 +01:00
parent e1580e51cf
commit 02b5df03ab
4 changed files with 41 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ namespace hex::fonts {
bool buildFontAtlas(FontAtlas *fontAtlas, std::fs::path fontPath, bool pixelPerfectFont, float fontSize, bool loadUnicodeCharacters, bool bold, bool italic, bool antialias);
static AutoReset<std::map<ImFont*, std::unique_ptr<FontAtlas>>> s_fontAtlases;
static AutoReset<std::map<UnlocalizedString, std::unique_ptr<FontAtlas>>> s_fontAtlases;
void loadFont(const ContentRegistry::Settings::Widgets::Widget &widget, const UnlocalizedString &name, ImFont **font, float scale) {
const auto &settings = static_cast<const FontSelector&>(widget);
@@ -51,7 +51,7 @@ namespace hex::fonts {
*font = atlas->getAtlas()->Fonts[0];
(*s_fontAtlases)[*font] = std::move(atlas);
(*s_fontAtlases)[name] = std::move(atlas);
}
bool setupFonts() {