Font fix for CJK systems

This commit is contained in:
Rafael 2016-07-22 01:08:05 +02:00
parent 8e3e0a9dbf
commit bc9a917aa2

View file

@ -27,6 +27,7 @@
#include "IconLoader.h" #include "IconLoader.h"
#include "AppEnv.h" #include "AppEnv.h"
#include "config.h" #include "config.h"
#include <QDesktopWidget>
#include <QApplication> #include <QApplication>
#include <QStringList> #include <QStringList>
#include <QTranslator> #include <QTranslator>
@ -51,16 +52,19 @@ int main(int argc, char *argv[])
a.setApplicationName(GTA5SYNC_APPSTR); a.setApplicationName(GTA5SYNC_APPSTR);
a.setApplicationVersion(GTA5SYNC_APPVER); a.setApplicationVersion(GTA5SYNC_APPVER);
setlocale(LC_ALL, "");
#ifdef GTA5SYNC_WIN #ifdef GTA5SYNC_WIN
// Get Windows Font // Get Windows Font
NONCLIENTMETRICS ncm; NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(ncm); ncm.cbSize = sizeof(ncm);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
LOGFONTW uiFont = ncm.lfMessageFont; LOGFONTW uiFont = ncm.lfMessageFont;
char faceName[32]; QString uiFontStr(QString::fromStdWString(std::wstring(uiFont.lfFaceName)));
char DefChar = ' ';
WideCharToMultiByte(CP_ACP, 0, uiFont.lfFaceName, -1, faceName, 32, &DefChar, NULL); #ifdef GTA5SYNC_DEBUG
QString uiFontStr(QString::fromStdString(std::string(faceName))); QMessageBox::information(a.desktop(), QApplication::tr("Font"), QApplication::tr("Selected Font: %1").arg(uiFontStr));
#endif
// Set Application Font // Set Application Font
QFont appFont(uiFontStr, 9); QFont appFont(uiFontStr, 9);