Default console font tweaks

* Lucida Console on Windows
* Menlo on OSX
* Monospace (resolved to whatever Monospace means) on linux
* Added ability to select proportional fonts in settings
This commit is contained in:
Petr Mrázek 2014-11-10 06:26:17 +01:00
parent a2ac9c5a3a
commit ec4805cce8
2 changed files with 18 additions and 10 deletions

View File

@ -380,21 +380,32 @@ void MultiMC::initGlobalSettings(bool test_mode)
// Remembered state // Remembered state
m_settings->registerSetting("LastUsedGroupForNewInstance", QString()); m_settings->registerSetting("LastUsedGroupForNewInstance", QString());
// in test mode, we don't have UI. QString defaultMonospace;
#ifdef Q_OS_WIN32
defaultMonospace = "Lucida Console";
#elif Q_OS_MAC
defaultMonospace = "Menlo";
#else
defaultMonospace = "Monospace";
#endif
if(!test_mode) if(!test_mode)
{ {
// Console settings // resolve the font so the default actually matches
QFont consoleFont; QFont consoleFont;
consoleFont.setFamily(""); consoleFont.setFamily(defaultMonospace);
consoleFont.setStyleHint(QFont::Monospace); consoleFont.setStyleHint(QFont::Monospace);
consoleFont.setFixedPitch(true); consoleFont.setFixedPitch(true);
QFontInfo consoleFontInfo(consoleFont); QFontInfo consoleFontInfo(consoleFont);
QString consoleFontFamily = consoleFontInfo.family(); QString resolvedDefaultMonospace = consoleFontInfo.family();
m_settings->registerSetting("ConsoleFont", consoleFontFamily); QFont resolvedFont(resolvedDefaultMonospace);
QLOG_DEBUG() << "Detected default console font:" << resolvedDefaultMonospace
<< ", substitutions:" << resolvedFont.substitutions().join(',');
m_settings->registerSetting("ConsoleFont", resolvedDefaultMonospace);
} }
else else
{ {
m_settings->registerSetting("ConsoleFont", "Courier"); // in test mode, we don't have UI, so we don't do any font resolving
m_settings->registerSetting("ConsoleFont", defaultMonospace);
} }
// FTB // FTB

View File

@ -42,7 +42,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="featuresTab"> <widget class="QWidget" name="featuresTab">
<attribute name="title"> <attribute name="title">
@ -383,9 +383,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="fontFilters">
<set>QFontComboBox::MonospacedFonts</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>