From f47b357b2309e208041f992568bf3898fe866a1c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 22 Jun 2024 11:25:32 +0200 Subject: [PATCH] impr: Reset unicode loading and scaling factor values if fonts fail to load --- plugins/fonts/source/font_loader.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/fonts/source/font_loader.cpp b/plugins/fonts/source/font_loader.cpp index cf7b13c02..61b900166 100644 --- a/plugins/fonts/source/font_loader.cpp +++ b/plugins/fonts/source/font_loader.cpp @@ -337,10 +337,17 @@ namespace hex::fonts { // If the build wasn't successful and Unicode characters are enabled, try again without them // If they were disabled already, something went wrong, and we can't recover from it - if (!shouldLoadUnicode) + if (!shouldLoadUnicode) { + // Reset Unicode loading and scaling factor settings back to default to make sure the user can still use the application + ContentRegistry::Settings::write("hex.builtin.setting.font", "hex.builtin.setting.font.load_all_unicode_chars", false); + + ContentRegistry::Settings::write("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling_factor", 1.0F); + ImHexApi::System::impl::setGlobalScale(1.0F); + return false; - else + } else { return buildFontAtlasImpl(false); + } } bool buildFontAtlas() {