fix(src/main): fix font size on mac os

This commit is contained in:
Ronan Abhamon 2017-06-07 16:05:15 +02:00
parent 2a77b298c6
commit e8804d608a
2 changed files with 15 additions and 6 deletions

View file

@ -206,9 +206,9 @@ void App::parseArgs () {
mParser.addVersionOption();
mParser.addOptions({
{ "config", tr("commandLineOptionConfig"), tr("commandLineOptionConfigArg") },
#ifndef __APPLE__
#ifndef Q_OS_MACOS
{ "iconified", tr("commandLineOptionIconified") },
#endif // ifndef __APPLE__
#endif // ifndef Q_OS_MACOS
{ "self-test", tr("commandLineOptionSelfTest") },
{ { "V", "verbose" }, tr("commandLineOptionVerbose") },
{ { "c", "cmd" }, tr("commandLineOptionCmd"), tr("commandLineOptionCmdArg") }

View file

@ -22,6 +22,7 @@
#include <QDirIterator>
#include <QFontDatabase>
#include <QScreen>
#include "app/App.hpp"
@ -40,11 +41,11 @@ int main (int argc, char *argv[]) {
// ---------------------------------------------------------------------------
// Options to get a nice video render.
#ifdef _WIN32
#ifdef Q_OS_WIN
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES, true);
#else
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL, true);
#endif // ifdef _WIN32
#endif // ifdef Q_OS_WIN
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
{
@ -92,8 +93,16 @@ int main (int argc, char *argv[]) {
}
}
app.setFont(QFont(DEFAULT_FONT));
qInfo() << QStringLiteral("Main font:") << app.font();
{
QFont font(DEFAULT_FONT);
#ifdef Q_OS_MACOS
// 72 dpi on MacOs...
font.setPointSizeF(font.pointSize() * 96.0 / 72.0);
#endif // ifdef Q_OS_MACOS
app.setFont(QFont(DEFAULT_FONT));
}
// ---------------------------------------------------------------------------
// Init and run!