1
0
mirror of synced 2024-11-13 18:50:53 +01:00

impr: Better logging during font loading

This commit is contained in:
WerWolv 2023-07-24 23:24:11 +02:00
parent bca73ef01e
commit 440e2d91fc
2 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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;