|
33 | 33 | typedef QApplication UchmviewerApp; |
34 | 34 | #endif |
35 | 35 |
|
| 36 | +#ifdef _WIN32 |
| 37 | + #include <windows.h> |
| 38 | +#endif |
| 39 | + |
36 | 40 | #if defined USE_DBUS |
37 | 41 | #include <QDBusConnection> |
38 | 42 | #include "dbus_interface.h" |
|
45 | 49 | MainWindow* mainWindow; |
46 | 50 |
|
47 | 51 |
|
| 52 | +void fallbackFonts() |
| 53 | +{ |
| 54 | +#ifdef _WIN32 |
| 55 | + // Obtain default GUI font (typically "Segoe UI, 9pt", see QTBUG-58610) |
| 56 | + QFont systemFont = QApplication::font("QMessageBox"); |
| 57 | + LANGID lid = GetUserDefaultLangID(); |
| 58 | + QStringList result; |
| 59 | + switch ( lid & 0xff ) |
| 60 | + { |
| 61 | + case LANG_CHINESE: |
| 62 | + if ( lid == 0x0804 || lid == 0x1004 ) // China mainland and Singapore |
| 63 | + result << "Microsoft YaHei UI" << "Microsoft YaHei" << "Arial" |
| 64 | + << "Microsoft JhengHei UI" << "Microsoft JhengHei" << "Malgun Gothic" << "Yu Gothic UI" << "Meiryo UI" |
| 65 | + << "Yu Gothic" << "Meiryo"; |
| 66 | + else |
| 67 | + result << "Microsoft JhengHei UI" << "Microsoft JhengHei" << "Arial" |
| 68 | + << "Microsoft YaHei UI" << "Microsoft YaHei" << "Malgun Gothic" << "Yu Gothic UI" << "Meiryo UI" |
| 69 | + << "Yu Gothic" << "Meiryo"; |
| 70 | + break; |
| 71 | + case LANG_JAPANESE: |
| 72 | + result << "Yu Gothic UI" << "Meiryo UI" << "Yu Gothic" << "Meiryo" << "Arial" |
| 73 | + << "Malgun Gothic" << "Microsoft YaHei UI" << "Microsoft YaHei" << "Microsoft JhengHei UI" << "Microsoft JhengHei"; |
| 74 | + break; |
| 75 | + case LANG_KOREAN: |
| 76 | + result << "Malgun Gothic" << "Arial" |
| 77 | + << "Microsoft JhengHei UI" << "Microsoft JhengHei" << "Microsoft YaHei UI" << "Microsoft YaHei" |
| 78 | + << "Yu Gothic UI" << "Meiryo UI" << "Yu Gothic" << "Meiryo"; |
| 79 | + break; |
| 80 | + default: |
| 81 | + result << "Arial" << "Yu Gothic UI" << "Meiryo UI" << "Yu Gothic" << "Meiryo" << "Malgun Gothic" |
| 82 | + << "Microsoft JhengHei UI" << "Microsoft JhengHei" << "Microsoft YaHei UI" << "Microsoft YaHei"; |
| 83 | + break; |
| 84 | + } |
| 85 | + result << "Nirmala UI" |
| 86 | + << "Iskoola Pota" |
| 87 | + << "Ebrima" |
| 88 | + << "Arial Unicode MS" |
| 89 | + << "Segoe UI Emoji" |
| 90 | + << "Segoe UI Symbol"; |
| 91 | + systemFont.insertSubstitutions(systemFont.family(), result); |
| 92 | + systemFont.setHintingPreference(QFont::PreferNoHinting); |
| 93 | + QApplication::setFont(systemFont); |
| 94 | +#endif |
| 95 | +} |
| 96 | + |
48 | 97 | int main( int argc, char** argv ) |
49 | 98 | { |
50 | 99 | #if QT_VERSION >= 0x050600 |
@@ -72,6 +121,8 @@ int main( int argc, char** argv ) |
72 | 121 | app.addLibraryPath( "qt-plugins" ); |
73 | 122 | #endif |
74 | 123 |
|
| 124 | + fallbackFonts(); |
| 125 | + |
75 | 126 | app_i18n::init(); |
76 | 127 |
|
77 | 128 | // Set data for QSettings |
|
0 commit comments