summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Main.cpp
diff options
context:
space:
mode:
authornyanpasu64 <nyanpasu64@tuta.io>2020-02-17 00:45:34 -0800
committernyanpasu64 <nyanpasu64@tuta.io>2020-02-17 05:37:54 -0800
commit44f602fe515f2bb02c774045da75fe01ca5ece38 (patch)
treeea3bdf1a09b4c76ccdbdc888be48d8bc5c19c678 /Source/Core/DolphinQt/Main.cpp
parent62046d93ce089659b49a1a5715c08fedf2af09a9 (diff)
Windows GUI: Use QMenu font (Segoe UI) for entire application
On Windows, Qt's default system font (MS Shell Dlg 2) is outdated. Dolphin previously used over 15 lines of code to compute a font closer to the proper font, but with an approximately correct font size. Using the QMenu font directly is both more concise and more elegant (in my opinion).
Diffstat (limited to 'Source/Core/DolphinQt/Main.cpp')
-rw-r--r--Source/Core/DolphinQt/Main.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp
index 55ea75f026..afb79aaf97 100644
--- a/Source/Core/DolphinQt/Main.cpp
+++ b/Source/Core/DolphinQt/Main.cpp
@@ -101,27 +101,12 @@ int main(int argc, char* argv[])
QApplication app(argc, argv);
#ifdef _WIN32
- // Get the default system font because Qt's way of obtaining it is outdated
- NONCLIENTMETRICSW metrics = {};
- LOGFONTW& logfont = metrics.lfMenuFont;
- metrics.cbSize = sizeof(metrics);
-
- if (SystemParametersInfoW(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::fromStdWString(logfont.lfFaceName));
-
- 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);
- }
+ // On Windows, Qt 5's default system font (MS Shell Dlg 2) is outdated.
+ // Interestingly, the QMenu font is correct and comes from lfMenuFont
+ // (Segoe UI on English computers).
+ // So use it for the entire application.
+ // This code will become unnecessary and obsolete once we switch to Qt 6.
+ QApplication::setFont(QApplication::font("QMenu"));
#endif
auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::IncludeGUIOptions);