From 440e2d91fc415cc44bafdd76d89dc3541a290d91 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 24 Jul 2023 23:24:11 +0200 Subject: [PATCH] impr: Better logging during font loading --- main/source/init/splash_window.cpp | 3 +-- main/source/init/tasks.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/main/source/init/splash_window.cpp b/main/source/init/splash_window.cpp index 9e105735f..157fdb33e 100644 --- a/main/source/init/splash_window.cpp +++ b/main/source/init/splash_window.cpp @@ -175,7 +175,7 @@ namespace hex::init { ImGui::NewFrame(); // Draw the splash screen background - auto drawList = ImGui::GetForegroundDrawList(); + auto drawList = ImGui::GetBackgroundDrawList(); { drawList->AddImage(splashBackgroundTexture, ImVec2(0, 0), splashBackgroundTexture.getSize() * scale); @@ -234,7 +234,6 @@ namespace hex::init { #endif drawList->AddText(ImVec2((splashBackgroundTexture.getSize().x * scale - ImGui::CalcTextSize(VersionInfo.c_str()).x) / 2, 105 * scale), ImColor(0xFF, 0xFF, 0xFF, 0xFF), VersionInfo.c_str()); - } // Draw the task progress bar diff --git a/main/source/init/tasks.cpp b/main/source/init/tasks.cpp index df879a165..f9133861b 100644 --- a/main/source/init/tasks.cpp +++ b/main/source/init/tasks.cpp @@ -198,9 +198,13 @@ namespace hex::init { // Load font related settings { std::fs::path fontFile = ContentRegistry::Settings::read("hex.builtin.setting.font", "hex.builtin.setting.font.font_path", ""); - if (!wolv::io::fs::exists(fontFile) || !wolv::io::fs::isRegularFile(fontFile)) { - log::warn("Custom font file {} not found! Falling back to default font.", wolv::util::toUTF8String(fontFile)); - fontFile.clear(); + if (!fontFile.empty()) { + if (!wolv::io::fs::exists(fontFile) || !wolv::io::fs::isRegularFile(fontFile)) { + log::warn("Custom font file {} not found! Falling back to default font.", wolv::util::toUTF8String(fontFile)); + fontFile.clear(); + } + + log::info("Loading custom font from {}", wolv::util::toUTF8String(fontFile)); } // If no custom font has been specified, search for a file called "font.ttf" in one of the resource folders @@ -208,7 +212,7 @@ namespace hex::init { for (const auto &dir : fs::getDefaultPaths(fs::ImHexPath::Resources)) { auto path = dir / "font.ttf"; if (wolv::io::fs::exists(path)) { - log::info("Loading custom front from {}", wolv::util::toUTF8String(path)); + log::info("Loading custom font from {}", wolv::util::toUTF8String(path)); fontFile = path; break;