Allow to change font settings in the launcher

pull/3228/head
Andrei Kortunov 2 years ago
parent 28d6159b86
commit c3d3f3140b

@ -205,6 +205,8 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(useZoomOnMapCheckBox, "allow zooming", "Map");
loadSettingBool(graphicHerbalismCheckBox, "graphic herbalism", "Game");
scalingSpinBox->setValue(Settings::Manager::getFloat("scaling factor", "GUI"));
fontSizeSpinBox->setValue(Settings::Manager::getInt("font size", "GUI"));
ttfResolutionSpinBox->setValue(Settings::Manager::getInt("ttf resolution", "GUI"));
}
// Bug fixes
@ -365,9 +367,18 @@ void Launcher::AdvancedPage::saveSettings()
saveSettingBool(stretchBackgroundCheckBox, "stretch menu background", "GUI");
saveSettingBool(useZoomOnMapCheckBox, "allow zooming", "Map");
saveSettingBool(graphicHerbalismCheckBox, "graphic herbalism", "Game");
float uiScalingFactor = scalingSpinBox->value();
if (uiScalingFactor != Settings::Manager::getFloat("scaling factor", "GUI"))
Settings::Manager::setFloat("scaling factor", "GUI", uiScalingFactor);
int fontSize = fontSizeSpinBox->value();
if (fontSize != Settings::Manager::getInt("font size", "GUI"))
Settings::Manager::setInt("font size", "GUI", fontSize);
int ttfResolution = ttfResolutionSpinBox->value();
if (ttfResolution != Settings::Manager::getInt("ttf resolution", "GUI"))
Settings::Manager::setInt("ttf resolution", "GUI", ttfResolution);
}
// Bug fixes

@ -473,7 +473,7 @@ namespace Gui
// to allow to configure font size via config file, without need to edit XML files.
// Also we should take UI scaling factor in account.
int resolution = Settings::Manager::getInt("ttf resolution", "GUI");
resolution = std::clamp(resolution, 48, 960) * mScalingFactor;
resolution = std::clamp(resolution, 50, 125) * mScalingFactor;
MyGUI::xml::ElementPtr resolutionNode = resourceNode->createChild("Property");
resolutionNode->addAttribute("key", "Resolution");
@ -517,7 +517,7 @@ namespace Gui
// setup separate fonts with different Resolution to fit these windows.
// These fonts have an internal prefix.
int resolution = Settings::Manager::getInt("ttf resolution", "GUI");
resolution = std::clamp(resolution, 48, 960);
resolution = std::clamp(resolution, 50, 125);
float currentX = Settings::Manager::getInt("resolution x", "Video");
float currentY = Settings::Manager::getInt("resolution y", "Video");

@ -24,16 +24,20 @@ Allows to specify glyph size for in-game fonts.
Note: default bitmap fonts are supposed to work with 16px size, otherwise glyphs will be blurry.
TrueType fonts do not have this issue.
This setting can be configured in the Interface section of Advanced tab of the launcher.
ttf resolution
--------------
:Type: integer
:Range: 48 to 960
:Default: 96
:Range: 50 to 125
:Default: 75
Allows to specify resolution for in-game TrueType fonts.
Note: actual resolution depends on "scaling factor" setting value, this value is for 1.0 scaling factor.
This setting can be configured in the Interface section of Advanced tab of the launcher.
menu transparency
-----------------

@ -193,7 +193,7 @@ scaling factor = 1.0
font size = 16
# Resolution of TrueType fonts glyphs
ttf resolution = 96
ttf resolution = 75
# Transparency of GUI windows (0.0 to 1.0, transparent to opaque).
menu transparency = 0.84

@ -1005,6 +1005,93 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="ttfResolutionLabel">
<property name="toolTip">
<string>Resolution of TrueType fonts glyphs. Automatically takes in account UI scaling factor.
Lower values make text more blurry, higher ones - more pixelated.</string>
</property>
<property name="text">
<string>TTF resolution</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="ttfResolutionSpinBox">
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>75</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="fontSizeLabel">
<property name="toolTip">
<string>Size of characters in game texts.</string>
</property>
<property name="text">
<string>Font size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="fontSizeSpinBox">
<property name="minimum">
<number>12</number>
</property>
<property name="maximum">
<number>20</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showEffectDurationCheckBox">
<property name="toolTip">

Loading…
Cancel
Save