From 6a473f20ca5935140f2427a2195d9c0ad8f38496 Mon Sep 17 00:00:00 2001 From: xdustinface Date: Wed, 8 Jul 2020 15:22:20 +0200 Subject: [PATCH 1/2] qt: Call GUIUtil::loadFonts earlier. Before there is any usage of the font helpers. --- src/qt/dash.cpp | 10 ++++++---- src/qt/guiutil.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index e22daa30a4ea..bc70898f0e7a 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -272,9 +272,6 @@ bool BitcoinCore::baseInitialize() { return false; } - if (!GUIUtil::loadFonts()) { - return false; - } return true; } @@ -693,7 +690,12 @@ int main(int argc, char *argv[]) app.parameterSetup(); // Load GUI settings from QSettings app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); - + // Load custom application fonts and setup font management + if (!GUIUtil::loadFonts()) { + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Failed to load application fonts.")); + return EXIT_FAILURE; + } // Validate/set font family if (gArgs.IsArgSet("-font-family")) { GUIUtil::FontFamily family; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 6d75c56c52a6..99773d28498c 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1183,7 +1183,7 @@ bool loadFonts() // Fail if an added id is -1 which means QFontDatabase::addApplicationFont failed. if (std::find(vecFontIds.begin(), vecFontIds.end(), -1) != vecFontIds.end()) { - return InitError("Font loading failed."); + return false; } // Print debug logs for added fonts fetched by the added ids From c950f0bdfa09b1dcd012e0f99290d5e05ff0e6d4 Mon Sep 17 00:00:00 2001 From: dustinface <35775977+xdustinface@users.noreply.github.com> Date: Wed, 8 Jul 2020 21:02:41 +0200 Subject: [PATCH 2/2] Apply review suggestion Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> --- src/qt/dash.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/dash.cpp b/src/qt/dash.cpp index bc70898f0e7a..fd0e31715b09 100644 --- a/src/qt/dash.cpp +++ b/src/qt/dash.cpp @@ -692,9 +692,9 @@ int main(int argc, char *argv[]) app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); // Load custom application fonts and setup font management if (!GUIUtil::loadFonts()) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), - QObject::tr("Error: Failed to load application fonts.")); - return EXIT_FAILURE; + QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), + QObject::tr("Error: Failed to load application fonts.")); + return EXIT_FAILURE; } // Validate/set font family if (gArgs.IsArgSet("-font-family")) {