浏览代码

Qt5 work around for suzhou numerals

When windows is told to display Standard digits as suzhou, it is showing
incorrect information in yuzu, file sizes and the CPU speed limiter are
effected by this. See #8698 for some screenshots.

Setting number format to Chinese (Simplified, Hong Kong SAR) is one
way to see this issue in action.

Fixes #8698
Kyle Kienapfel 4 年之前
父节点
当前提交
63673dcf98
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/yuzu/main.cpp

+ 9 - 0
src/yuzu/main.cpp

@@ -4067,6 +4067,15 @@ int main(int argc, char* argv[]) {
     QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
     QApplication app(argc, argv);
 
+    // Workaround for QTBUG-85409, for Suzhou numerals the number 1 is actually \u3021
+    // so we can see if we get \u3008 instead
+    // TL;DR all other number formats are consecutive in unicode code points
+    // This bug is fixed in Qt6, specifically 6.0.0-alpha1
+    const QLocale locale = QLocale::system();
+    if (QStringLiteral("\u3008") == locale.toString(1)) {
+        QLocale::setDefault(QLocale::system().name());
+    }
+
     // Qt changes the locale and causes issues in float conversion using std::to_string() when
     // generating shaders
     setlocale(LC_ALL, "C");