diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index ff04a846ff..9f131a5fbd 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -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 diff --git a/components/fontloader/fontloader.cpp b/components/fontloader/fontloader.cpp index ad945f3590..4d727653cb 100644 --- a/components/fontloader/fontloader.cpp +++ b/components/fontloader/fontloader.cpp @@ -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"); diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index 91d2e67d6c..08f3fbd830 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -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 ----------------- diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 89090fa262..e69041d3fc 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -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 diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index bcf710ffea..574bf3ddf6 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -1005,6 +1005,93 @@ + + + + + + Resolution of TrueType fonts glyphs. Automatically takes in account UI scaling factor. +Lower values make text more blurry, higher ones - more pixelated. + + + TTF resolution + + + + + + + 50 + + + 125 + + + 5 + + + 75 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Size of characters in game texts. + + + Font size + + + + + + + 12 + + + 20 + + + 1 + + + 16 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + +