summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2018-05-06 01:23:13 +0200
committerspycrab <spycrab@users.noreply.github.com>2018-05-06 02:37:52 +0200
commit49a1b2e5df95b3077c79e94d502e4441ca080cb7 (patch)
tree54da8739fa7e06d0093f89746ab207f6e25bdb49 /Source/Core
parent58b96eeb9df32030761af0aecbeb7a6b994d12eb (diff)
Qt/Win32: Use better method to obtain the default font
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt2/Main.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt2/Main.cpp b/Source/Core/DolphinQt2/Main.cpp
index 4dca310148..6b1dda6f78 100644
--- a/Source/Core/DolphinQt2/Main.cpp
+++ b/Source/Core/DolphinQt2/Main.cpp
@@ -5,6 +5,8 @@
#ifdef _WIN32
#include <Windows.h>
#include <cstdio>
+
+#include "Common/StringUtil.h"
#endif
#include <OptionParser.h>
@@ -94,14 +96,27 @@ int main(int argc, char* argv[])
QApplication app(argc, argv);
#ifdef _WIN32
- // Force the default font to Segoe UI on Windows
- QFont font = QApplication::font();
- font.setFamily(QStringLiteral("Segoe UI"));
-
- // The default font size is a bit too small
- font.setPointSize(QFontInfo(font).pointSize() * 1.2);
+ // Get the default system font because Qt's way of obtaining it is outdated
+ NONCLIENTMETRICS metrics = {};
+ auto& logfont = metrics.lfMenuFont;
+ metrics.cbSize = sizeof(NONCLIENTMETRICS);
- QApplication::setFont(font);
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0))
+ {
+ // Sadly Qt 5 doesn't support turning a native font handle into a QFont so this is the next best
+ // thing
+ QFont font = QApplication::font();
+ font.setFamily(QString::fromStdString(UTF16ToUTF8(logfont.lfFaceName)));
+ font.setWeight(logfont.lfWeight);
+ font.setItalic(logfont.lfItalic);
+ font.setStrikeOut(logfont.lfStrikeOut);
+ font.setUnderline(logfont.lfUnderline);
+
+ // The default font size is a bit too small
+ font.setPointSize(QFontInfo(font).pointSize() * 1.2);
+
+ QApplication::setFont(font);
+ }
#endif
auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::IncludeGUIOptions);