summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Kyle Kienapfel2022-10-01 15:27:23 -0700
committerGravatar Kyle Kienapfel2022-10-01 15:27:23 -0700
commit1dba5fab626b2b441d069a668fd148232384da14 (patch)
treebf55045acd046958e462a3061fe4a4b450993a65 /src
parentMerge pull request #8876 from FearlessTobi/multiplayer-part3 (diff)
downloadyuzu-1dba5fab626b2b441d069a668fd148232384da14.tar.gz
yuzu-1dba5fab626b2b441d069a668fd148232384da14.tar.xz
yuzu-1dba5fab626b2b441d069a668fd148232384da14.zip
Qt: work around Qt5's font choice for Chinese
On Windows there are currently two fonts used. The first, does the Menu, QTreeView and Tooltips Second is Everything else which is a default font. From inspecting QApplication::font() at runtime Windows 10 English: QFont(MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0) Windows 11 Japanese: MS UI Gothic,9 ,-1,5,50,0,0,0,0,0 Windows 11 Traditional Chinese: PMingLiU,9 ,-1,5,50,0,0,0,0,0 Windows 11 Simplified Chinese: SimSun,9 ,-1,5,50,0,0,0,0,0 Windows 11 Korean: Gulim,9 ,-1,5,50,0,0,0,0,0 I initially investigated dynamically changing the font when the UI language is English, but this was getting quite messy Qt6 makes changes to default font in some situations, so this PR is being narrowed in scope to only effect Chinese font choices. This change only effects rendering of Latin/Cyrillic characters.
Diffstat (limited to '')
-rw-r--r--src/yuzu/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 612b8dbb8..fc094ea1d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -261,6 +261,18 @@ static QString PrettyProductName() {
261 return QSysInfo::prettyProductName(); 261 return QSysInfo::prettyProductName();
262} 262}
263 263
264#ifdef _WIN32
265static void OverrideWindowsFont() {
266 // Qt5 chooses these fonts on Windows and they have fairly ugly alphanumeric/cyrllic characters
267 // Asking to use "MS Shell Dlg 2" gives better other chars while leaving the Chinese Characters.
268 const QString startup_font = QApplication::font().family();
269 const QStringList ugly_fonts = {QStringLiteral("SimSun"), QStringLiteral("PMingLiU")};
270 if (ugly_fonts.contains(startup_font)) {
271 QApplication::setFont(QFont(QStringLiteral("MS Shell Dlg 2"), 9, QFont::Normal));
272 }
273}
274#endif
275
264bool GMainWindow::CheckDarkMode() { 276bool GMainWindow::CheckDarkMode() {
265#ifdef __linux__ 277#ifdef __linux__
266 const QPalette test_palette(qApp->palette()); 278 const QPalette test_palette(qApp->palette());
@@ -4134,6 +4146,10 @@ int main(int argc, char* argv[]) {
4134 QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); 4146 QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
4135 QApplication app(argc, argv); 4147 QApplication app(argc, argv);
4136 4148
4149#ifdef _WIN32
4150 OverrideWindowsFont();
4151#endif
4152
4137 // Workaround for QTBUG-85409, for Suzhou numerals the number 1 is actually \u3021 4153 // Workaround for QTBUG-85409, for Suzhou numerals the number 1 is actually \u3021
4138 // so we can see if we get \u3008 instead 4154 // so we can see if we get \u3008 instead
4139 // TL;DR all other number formats are consecutive in unicode code points 4155 // TL;DR all other number formats are consecutive in unicode code points