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/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp index f5fc164ee2..3dab0a7772 100644 --- a/apps/openmw/mwgui/birth.cpp +++ b/apps/openmw/mwgui/birth.cpp @@ -184,8 +184,8 @@ namespace MWGui return; Widgets::MWSpellPtr spellWidget; - const int lineHeight = 18; - MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18); + const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2; + MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); diff --git a/apps/openmw/mwgui/itemwidget.cpp b/apps/openmw/mwgui/itemwidget.cpp index 1ae683f3b4..3f0ac39693 100644 --- a/apps/openmw/mwgui/itemwidget.cpp +++ b/apps/openmw/mwgui/itemwidget.cpp @@ -20,6 +20,8 @@ namespace { std::string getCountString(int count) { + static const int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight(); + if (count == 1) return ""; @@ -29,6 +31,8 @@ namespace return MyGUI::utility::toString(count/1000000) + "m"; else if (count > 9999) return MyGUI::utility::toString(count/1000) + "k"; + else if (fontHeight >= 18 && count > 999) + return MyGUI::utility::toString(count/1000) + "k"; else return MyGUI::utility::toString(count); } diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 6427499283..e1bacf4619 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -400,7 +400,7 @@ namespace MWGui return; Widgets::MWSkillPtr skillWidget; - const int lineHeight = 18; + const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2; MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); @@ -436,8 +436,8 @@ namespace MWGui if (mCurrentRaceId.empty()) return; - const int lineHeight = 18; - MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18); + const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2; + MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), lineHeight); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Race *race = store.get().find(mCurrentRaceId); diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index d2429dfcf0..a843991ea6 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -812,7 +812,7 @@ namespace MWGui void SettingsWindow::layoutControlsBox() { - const int h = 18; + const int h = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2; const int w = mControlsBox->getWidth() - 28; const int noWidgetsInRow = 2; const int totalH = mControlsBox->getChildCount() / noWidgetsInRow * h; diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp index a8b7cb6398..fe081e0b16 100644 --- a/apps/openmw/mwgui/spellview.cpp +++ b/apps/openmw/mwgui/spellview.cpp @@ -5,6 +5,9 @@ #include #include +#include "../mwbase/environment.hpp" +#include "../mwbase/windowmanager.hpp" + #include #include @@ -84,7 +87,7 @@ namespace MWGui int curType = -1; - const int spellHeight = 18; + const int spellHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2; mLines.clear(); 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/font.rst b/docs/source/reference/modding/font.rst index 6f17fa2fa7..d92abafda2 100644 --- a/docs/source/reference/modding/font.rst +++ b/docs/source/reference/modding/font.rst @@ -45,9 +45,9 @@ It is also possible to adjust the font size and resolution via ``settings.cfg`` [GUI] font size = 16 - ttf resolution = 96 + ttf resolution = 75 -The ``font size`` setting accepts clamped values in range from 12 to 20 while ``ttf resolution`` setting accepts values from 48 to 960. +The ``font size`` setting accepts clamped values in range from 12 to 20 while ``ttf resolution`` setting accepts values from 50 to 125. Any Resolution or Size properties in the ``.omwfont`` file have no effect because the engine settings override them. 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/data/mygui/openmw_settings_window.layout b/files/data/mygui/openmw_settings_window.layout index 79afa0687b..d698844d2e 100644 --- a/files/data/mygui/openmw_settings_window.layout +++ b/files/data/mygui/openmw_settings_window.layout @@ -275,18 +275,18 @@ - - + + - + - + @@ -296,7 +296,7 @@ - + @@ -306,7 +306,7 @@ - + @@ -320,7 +320,7 @@ - + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 9c7efe165e..644858c4ff 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..c6c2ffeab2 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -906,15 +906,8 @@ - - - - - Show owned: - - - - + + 1 @@ -941,37 +934,7 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - <html><head/><body><p>This setting scales GUI windows. A value of 1.0 results in the normal scale.</p></body></html> - - - GUI scaling factor - - - - + 2 @@ -990,101 +953,158 @@ - - - - Qt::Horizontal + + + + 12 - - - 40 - 20 - + + 20 - + + 1 + + + 16 + + + + + + + <html><head/><body><p>This setting scales GUI windows. A value of 1.0 results in the normal scale.</p></body></html> + + + GUI scaling factor + + + + + + + <html><head/><body><p>Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. </p><p>The default value is false.</p></body></html> + + + Show effect duration + + + + + + + <html><head/><body><p>If this setting is true, dialogue topics will have a different color if the topic is specific to the NPC you're talking to or the topic was previously seen. Color can be changed in settings.cfg.</p><p>The default value is false.</p></body></html> + + + Change dialogue topic color + + + + + + + Size of characters in game texts. + + + Font size + + + + + + + <html><head/><body><p>Enable zooming on local and global maps.</p></body></html> + + + Can zoom on maps + + + + + + + <html><head/><body><p>If this setting is true, containers supporting graphic herbalism will do so instead of opening the menu.</p></body></html> + + + Enable graphic herbalism + + + + + + + <html><head/><body><p>If this setting is true, damage bonus of arrows and bolts will be shown on item tooltip.</p><p>The default value is false.</p></body></html> + + + Show projectile damage + + + + + + + <html><head/><body><p>If this setting is true, melee weapons reach and speed will be shown on item tooltip.</p><p>The default value is false.</p></body></html> + + + Show melee info + + + + + + + <html><head/><body><p>Stretch menus, load screens, etc. to the window aspect ratio.</p></body></html> + + + Stretch menu background + + + + + + + Show owned objects + + + + + + + <html><head/><body><p>Whether or not the chance of success will be displayed in the enchanting menu.</p><p>The default value is false.</p></body></html> + + + Show enchant chance + + + + + + + Resolution of TrueType fonts glyphs. Automatically takes in account UI scaling factor. +Lower values make text more blurry, higher ones - more pixelated. + + + TTF texture resolution + + + + + + + 50 + + + 125 + + + 5 + + + 75 + + - - - - <html><head/><body><p>Show the remaining duration of magic effects and lights if this setting is true. The remaining duration is displayed in the tooltip by hovering over the magical effect. </p><p>The default value is false.</p></body></html> - - - Show effect duration - - - - - - - <html><head/><body><p>Whether or not the chance of success will be displayed in the enchanting menu.</p><p>The default value is false.</p></body></html> - - - Show enchant chance - - - - - - - <html><head/><body><p>If this setting is true, melee weapons reach and speed will be shown on item tooltip.</p><p>The default value is false.</p></body></html> - - - Show melee info - - - - - - - <html><head/><body><p>If this setting is true, damage bonus of arrows and bolts will be shown on item tooltip.</p><p>The default value is false.</p></body></html> - - - Show projectile damage - - - - - - - <html><head/><body><p>If this setting is true, dialogue topics will have a different color if the topic is specific to the NPC you're talking to or the topic was previously seen. Color can be changed in settings.cfg.</p><p>The default value is false.</p></body></html> - - - Change dialogue topic color - - - - - - - <html><head/><body><p>Stretch menus, load screens, etc. to the window aspect ratio.</p></body></html> - - - Stretch menu background - - - - - - - <html><head/><body><p>Enable zooming on local and global maps.</p></body></html> - - - Can zoom on maps - - - - - - - <html><head/><body><p>If this setting is true, containers supporting graphic herbalism will do so instead of opening the menu.</p></body></html> - - - Enable graphic herbalism - - -