diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2018-05-10 18:15:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-10 18:15:38 +0200 |
| commit | 02e313050e0e722a4a03d0ff7b5ea5aba0bbc908 (patch) | |
| tree | 973c8670556359410cde78daa742a1461e8e7b08 /Source/Core | |
| parent | fd1ea63383f7d9189a14a99948e08fddc4e4d7ee (diff) | |
| parent | 273579bc32ed71879c3e1f034761f623c4c33219 (diff) | |
Merge pull request #6800 from spycrab/qt_win32_weight
Qt/Win32: Fix font weight calculation
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt2/Main.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/DolphinQt2/Main.cpp b/Source/Core/DolphinQt2/Main.cpp index 6b1dda6f78..eb49052642 100644 --- a/Source/Core/DolphinQt2/Main.cpp +++ b/Source/Core/DolphinQt2/Main.cpp @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) #ifdef _WIN32 // Get the default system font because Qt's way of obtaining it is outdated NONCLIENTMETRICS metrics = {}; - auto& logfont = metrics.lfMenuFont; + LOGFONT& logfont = metrics.lfMenuFont; metrics.cbSize = sizeof(NONCLIENTMETRICS); if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) @@ -107,7 +107,12 @@ int main(int argc, char* argv[]) // thing QFont font = QApplication::font(); font.setFamily(QString::fromStdString(UTF16ToUTF8(logfont.lfFaceName))); - font.setWeight(logfont.lfWeight); + + // LOGFONT uses a scale from 1 to 1000 to represent font weight while Qt uses a scale from 0 + // to 99. LOGFONT also has a DONTCARE value which we have to ignore. + if (logfont.lfWeight != FW_DONTCARE) + font.setWeight((logfont.lfWeight / 10) - 1); + font.setItalic(logfont.lfItalic); font.setStrikeOut(logfont.lfStrikeOut); font.setUnderline(logfont.lfUnderline); |
