1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 09:32:45 +00:00

Merge branch 'font_fixes' into 'master'

Font fixes

See merge request OpenMW/openmw!2297
This commit is contained in:
psi29a 2022-08-18 12:53:37 +00:00
commit 7bb1856b74
12 changed files with 193 additions and 151 deletions

View File

@ -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

View File

@ -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();

View File

@ -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);
}

View File

@ -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<ESM::Race>().find(mCurrentRaceId);

View File

@ -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;

View File

@ -5,6 +5,9 @@
#include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include <components/widgets/sharedstatebutton.hpp>
#include <components/widgets/box.hpp>
@ -84,7 +87,7 @@ namespace MWGui
int curType = -1;
const int spellHeight = 18;
const int spellHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
mLines.clear();

View File

@ -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");

View File

@ -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.

View File

@ -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
-----------------

View File

@ -275,18 +275,18 @@
<Property key="ButtonAutoWidth" value="true"/>
<Widget type="TabItem">
<Property key="Caption" value=" #{sVideo} "/>
<Widget type="ListBox" skin="MW_List" position="0 4 170 215" align="Left Top" name="ResolutionList"/>
<Widget type="TextBox" skin="NormalText" position="182 4 170 18" align="Left Top">
<Widget type="ListBox" skin="MW_List" position="0 4 185 215" align="Left Top" name="ResolutionList"/>
<Widget type="TextBox" skin="NormalText" position="197 4 185 18" align="Left Top">
<Property key="Caption" value="#{SettingsMenu:WindowMode}"/>
</Widget>
<Widget type="HBox" position="182 28 400 24">
<Widget type="HBox" position="197 28 400 24">
<Widget type="ComboBox" skin="MW_ComboBox" position="0 0 200 24" align="Left Top" name="WindowModeList">
<Property key="AddItem" value="#{SettingsMenu:WindowModeFullscreen}"/>
<Property key="AddItem" value="#{SettingsMenu:WindowModeWindowedFullscreen}"/>
<Property key="AddItem" value="#{SettingsMenu:WindowModeWindowed}"/>
</Widget>
</Widget>
<Widget type="HBox" position="182 64 400 24">
<Widget type="HBox" position="197 64 400 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="VSyncButton">
<UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="vsync"/>
@ -296,7 +296,7 @@
<Property key="Caption" value="#{SettingsMenu:VSync}"/>
</Widget>
</Widget>
<Widget type="HBox" position="182 94 300 24">
<Widget type="HBox" position="197 94 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
<UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="window border"/>
@ -306,7 +306,7 @@
<Property key="Caption" value="#{SettingsMenu:WindowBorder}"/>
</Widget>
</Widget>
<Widget type="HBox" position="182 124 300 24">
<Widget type="HBox" position="197 124 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
<UserString key="SettingCategory" value="Post Processing"/>
<UserString key="SettingName" value="enabled"/>
@ -320,7 +320,7 @@
</Widget>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="182 154 300 32" align="Left Top">
<Widget type="AutoSizedTextBox" skin="SandText" position="197 154 300 32" align="Left Top">
<Property key="Caption" value="#{SettingsMenu:FrameRateHint}"/>
</Widget>

View File

@ -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

View File

@ -906,15 +906,8 @@
</attribute>
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item alignment="Qt::AlignRight">
<widget class="QLabel" name="showOwnedLabel">
<property name="text">
<string>Show owned:</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QComboBox" name="showOwnedComboBox">
<property name="currentIndex">
<number>1</number>
@ -941,37 +934,7 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="scalingLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This setting scales GUI windows. A value of 1.0 results in the normal scale.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>GUI scaling factor</string>
</property>
</widget>
</item>
<item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="scalingSpinBox">
<property name="decimals">
<number>2</number>
@ -990,101 +953,158 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="2" column="1">
<widget class="QSpinBox" name="fontSizeSpinBox">
<property name="minimum">
<number>12</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="maximum">
<number>20</number>
</property>
</spacer>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>16</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="scalingLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This setting scales GUI windows. A value of 1.0 results in the normal scale.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>GUI scaling factor</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showEffectDurationCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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. &lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show effect duration</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="changeDialogTopicsCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Change dialogue topic color</string>
</property>
</widget>
</item>
<item row="2" column="0">
<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 row="7" column="0">
<widget class="QCheckBox" name="useZoomOnMapCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable zooming on local and global maps.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Can zoom on maps</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="graphicHerbalismCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, containers supporting graphic herbalism will do so instead of opening the menu.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable graphic herbalism</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="showProjectileDamageCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, damage bonus of arrows and bolts will be shown on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show projectile damage</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="showMeleeInfoCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, melee weapons reach and speed will be shown on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show melee info</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="stretchBackgroundCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Stretch menus, load screens, etc. to the window aspect ratio.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Stretch menu background</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="showOwnedLabel">
<property name="text">
<string>Show owned objects</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="showEnchantChanceCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the chance of success will be displayed in the enchanting menu.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show enchant chance</string>
</property>
</widget>
</item>
<item row="3" column="0">
<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 texture resolution</string>
</property>
</widget>
</item>
<item row="3" column="1">
<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>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showEffectDurationCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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. &lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show effect duration</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showEnchantChanceCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the chance of success will be displayed in the enchanting menu.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show enchant chance</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showMeleeInfoCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, melee weapons reach and speed will be shown on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show melee info</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showProjectileDamageCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, damage bonus of arrows and bolts will be shown on item tooltip.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Show projectile damage</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="changeDialogTopicsCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;The default value is false.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Change dialogue topic color</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="stretchBackgroundCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Stretch menus, load screens, etc. to the window aspect ratio.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Stretch menu background</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useZoomOnMapCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable zooming on local and global maps.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Can zoom on maps</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="graphicHerbalismCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this setting is true, containers supporting graphic herbalism will do so instead of opening the menu.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable graphic herbalism</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">