Qt/FullscreenUI: Add Bold OSD Text option

Signed-off-by: SternXD <stern@sidestore.io>
This commit is contained in:
SternXD authored and lightningterror committed 2026-03-19 20:49:10 +01:00
1 parent 064a96dfd2
commit d9bfdc3fcd
6 files changed
+306 -179

No files matched your search

+4
View File
@@ -38,6 +38,7 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showHardwareInfo, "EmuCore/GS", "OsdShowHardwareInfo", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showVersion, "EmuCore/GS", "OsdShowVersion", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showSettings, "EmuCore/GS", "OsdShowSettings", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.boldText, "EmuCore/GS", "OsdBoldText", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showPatches, "EmuCore/GS", "OsdshowPatches", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showInputs, "EmuCore/GS", "OsdShowInputs", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showVideoCapture, "EmuCore/GS", "OsdShowVideoCapture", true);
@@ -98,6 +99,9 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
dialog()->registerWidgetHelp(m_ui.showSettings, tr("Show Settings"), tr("Unchecked"),
tr("Displays various settings and the current values of those settings in the bottom-right corner of the display."));
dialog()->registerWidgetHelp(m_ui.boldText, tr("Bold OSD Text"), tr("Checked"),
tr("Draws OSD text with heavier weight for improved readability."));
dialog()->registerWidgetHelp(m_ui.showPatches, tr("Show Patches"), tr("Unchecked"),
tr("Shows the amount of currently active patches/cheats in the bottom-right corner of the display."));
+190 -177
View File
@@ -20,36 +20,104 @@
<string>On-Screen Display</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="messagesPosLabel">
<item row="4" column="0">
<widget class="QLabel" name="boldTextLabel">
<property name="text">
<string>OSD Messages Position:</string>
<string>OSD Text Style:</string>
</property>
<property name="buddy">
<cstring>messagesPos</cstring>
<cstring>boldText</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="scale">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>500</number>
<item row="4" column="2">
<widget class="QCheckBox" name="boldText">
<property name="text">
<string>Bold OSD Text</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="7" column="0" colspan="3">
<spacer name="checkboxSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="scaleLabel">
<property name="text">
<string>OSD Scale:</string>
</property>
<property name="buddy">
<cstring>scale</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="performancePos">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Top Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top Center</string>
</property>
</item>
<item>
<property name="text">
<string>Top Right (Default)</string>
</property>
</item>
<item>
<property name="text">
<string>Center Left</string>
</property>
</item>
<item>
<property name="text">
<string>Center</string>
</property>
</item>
<item>
<property name="text">
<string>Center Right</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Left</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Center</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Right</string>
</property>
</item>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="messagesPos">
<item>
<property name="text">
@@ -103,8 +171,76 @@
</item>
</widget>
</item>
<item row="5" column="0" colspan="2">
<layout class="QGridLayout" name="optionLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0">
<item row="1" column="2">
<widget class="QSpinBox" name="margin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="scale">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="marginLabel">
<property name="text">
<string>OSD Margin:</string>
</property>
<property name="buddy">
<cstring>margin</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="performancePosLabel">
<property name="text">
<string>OSD Performance Position:</string>
</property>
<property name="buddy">
<cstring>performancePos</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="messagesPosLabel">
<property name="text">
<string>OSD Messages Position:</string>
</property>
<property name="buddy">
<cstring>messagesPos</cstring>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<layout class="QGridLayout" name="optionLayout" rowstretch="0,0,0,0,0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
@@ -121,7 +257,7 @@
</property>
</widget>
</item>
<item row="7" column="2">
<item row="8" column="2">
<widget class="QLabel" name="warningLabel">
<property name="text">
<string>Messages</string>
@@ -142,20 +278,6 @@
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="showInputRec">
<property name="text">
<string>Show Input Recording Status</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="showTextureReplacements">
<property name="text">
<string>Show Texture Replacement Status</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showResolution">
<property name="text">
@@ -219,21 +341,7 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="showVideoCapture">
<property name="text">
<string>Show Video Capture Status</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="showInputs">
<property name="text">
<string>Show Inputs</string>
</property>
</widget>
</item>
<item row="8" column="2">
<item row="9" column="2">
<widget class="QCheckBox" name="warnAboutUnsafeSettings">
<property name="text">
<string>Warn About Unsafe Settings</string>
@@ -268,127 +376,36 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="showInputs">
<property name="text">
<string>Show Inputs</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="showVideoCapture">
<property name="text">
<string>Show Video Capture Status</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="showInputRec">
<property name="text">
<string>Show Input Recording Status</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="showTextureReplacements">
<property name="text">
<string>Show Texture Replacement Status</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="scaleLabel">
<property name="text">
<string>OSD Scale:</string>
</property>
<property name="buddy">
<cstring>scale</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="marginLabel">
<property name="text">
<string>OSD Margin:</string>
</property>
<property name="buddy">
<cstring>margin</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="margin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="performancePos">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Top Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top Center</string>
</property>
</item>
<item>
<property name="text">
<string>Top Right (Default)</string>
</property>
</item>
<item>
<property name="text">
<string>Center Left</string>
</property>
</item>
<item>
<property name="text">
<string>Center</string>
</property>
</item>
<item>
<property name="text">
<string>Center Right</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Left</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Center</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Right</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="checkboxSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="performancePosLabel">
<property name="text">
<string>OSD Performance Position:</string>
</property>
<property name="buddy">
<cstring>performancePos</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -412,6 +429,7 @@
<tabstop>margin</tabstop>
<tabstop>messagesPos</tabstop>
<tabstop>performancePos</tabstop>
<tabstop>boldText</tabstop>
<tabstop>showSpeedPercentages</tabstop>
<tabstop>showFPS</tabstop>
<tabstop>showVPS</tabstop>
@@ -424,11 +442,6 @@
<tabstop>showHardwareInfo</tabstop>
<tabstop>showVersion</tabstop>
<tabstop>showSettings</tabstop>
<tabstop>showPatches</tabstop>
<tabstop>showInputs</tabstop>
<tabstop>showVideoCapture</tabstop>
<tabstop>showInputRec</tabstop>
<tabstop>showTextureReplacements</tabstop>
<tabstop>warnAboutUnsafeSettings</tabstop>
</tabstops>
<resources/>
+1
View File
@@ -782,6 +782,7 @@ struct Pcsx2Config
OsdShowVideoCapture : 1,
OsdShowInputRec : 1,
OsdShowTextureReplacements : 1,
OsdBoldText : 1,
HWSpinGPUForReadbacks : 1,
HWSpinCPUForReadbacks : 1,
GPUPaletteConversion : 1,
+3
View File
@@ -3212,6 +3212,9 @@ void FullscreenUI::DrawOSDSettingsPage()
DrawStringListSetting(bsi, FSUI_ICONSTR(ICON_FA_CHART_BAR, "OSD Performance Position"),
FSUI_CSTR("Determines where performance statistics are positioned."), "EmuCore/GS", "OsdPerformancePos", "3",
s_osd_position_options, s_osd_position_values, std::size(s_osd_position_options), true);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BOLD, "Bold OSD Text"),
FSUI_CSTR("Draws OSD text with heavier weight for improved readability."),
"EmuCore/GS", "OsdBoldText", true);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_CODE_MERGE, "Show PCSX2 Version"),
FSUI_CSTR("Shows the current PCSX2 version."), "EmuCore/GS",
"OsdShowVersion", false);
+107 -2
View File
@@ -225,8 +225,106 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
{ \
text_size = font->CalcTextSizeA(size, std::numeric_limits<float>::max(), -1.0f, (text), nullptr, nullptr); \
const ImVec2 text_pos = CalculatePerformanceOverlayTextPosition(GSConfig.OsdPerformancePos, margin, text_size, GetWindowWidth(), position_y); \
const bool __bold_osd = GSConfig.OsdBoldText; \
dl->AddText(font, size, ImVec2(text_pos.x + shadow_offset, text_pos.y + shadow_offset), IM_COL32(0, 0, 0, 100), (text)); \
dl->AddText(font, size, text_pos, color, (text)); \
const auto __is_all_digits = [](const char* __begin, const char* __end) -> bool \
{ \
for (const char* __c = __begin; __c < __end; __c++) \
{ \
if (!std::isdigit(static_cast<unsigned char>(*__c))) \
return false; \
} \
return true; \
}; \
const auto __is_all_alpha = [](const char* __begin, const char* __end) -> bool \
{ \
for (const char* __c = __begin; __c < __end; __c++) \
{ \
if (!std::isalpha(static_cast<unsigned char>(*__c))) \
return false; \
} \
return true; \
}; \
for (const char* __p = (text); __p && *__p;) \
{ \
const char* __sep = strstr(__p, " | "); \
const char* __seg_end = __sep ? __sep : __p + strlen(__p); \
const char* __label_begin = nullptr; \
const char* __label_end = nullptr; \
const unsigned char __first = static_cast<unsigned char>(*__p); \
const bool __starts_numeric = (std::isdigit(__first) || __first == '+' || __first == '-' || __first == '.'); \
for (const char* __c = __p; __c < __seg_end; __c++) \
{ \
if (*__c == ':') \
{ \
__label_begin = __p; \
__label_end = __c + 1; \
break; \
} \
} \
if (!__label_begin) \
{ \
if (!__starts_numeric) \
{ \
__label_begin = __p; \
__label_end = __seg_end; \
} \
else \
{ \
const char* __first_space = __p; \
while (__first_space < __seg_end && *__first_space != ' ') \
__first_space++; \
if (__first_space < __seg_end) \
{ \
const char* __x = __p; \
while (__x < __first_space && *__x != 'x' && *__x != 'X') \
__x++; \
const bool __has_resolution_prefix = \
(__x > __p && (__x + 1) < __first_space && \
__is_all_digits(__p, __x) && __is_all_digits(__x + 1, __first_space)); \
if (__has_resolution_prefix && (__first_space + 1) < __seg_end) \
{ \
__label_begin = __first_space + 1; \
__label_end = __seg_end; \
const char* __trim_end = __label_end; \
while (__trim_end > __label_begin && std::isspace(static_cast<unsigned char>(*(__trim_end - 1)))) \
__trim_end--; \
if (__trim_end > __label_begin && *(__trim_end - 1) == ')') \
{ \
const char* __open = __trim_end - 1; \
while (__open > __label_begin && *__open != '(') \
__open--; \
if (__open > __label_begin && *__open == '(' && *(__open - 1) == ' ') \
__label_end = __open - 1; \
} \
} \
} \
if (!__label_begin) \
{ \
const char* __space = __seg_end; \
while (__space > __p && *(__space - 1) != ' ') \
__space--; \
if (__space > __p && __space < __seg_end && __is_all_alpha(__space, __seg_end)) \
{ \
__label_begin = __space; \
__label_end = __seg_end; \
} \
} \
} \
} \
if (__label_begin && __label_end && __label_begin < __label_end) \
{ \
const float __x0 = font->CalcTextSizeA(size, FLT_MAX, -1.0f, (text), __label_begin).x; \
const ImVec2 __pos(text_pos.x + __x0, text_pos.y); \
if (__bold_osd) \
{ \
dl->AddText(font, size, __pos, color, __label_begin, __label_end); \
dl->AddText(font, size, ImVec2(__pos.x + 0.6f, __pos.y), color, __label_begin, __label_end); \
} \
} \
__p = __sep ? __sep + 3 : nullptr; \
} \
position_y += text_size.y + spacing; \
} while (0)
@@ -671,11 +769,18 @@ __ri void ImGuiManager::DrawSettingsOverlay(float scale, float margin, float spa
ImDrawList* dl = ImGui::GetBackgroundDrawList();
ImVec2 text_size =
font->CalcTextSizeA(font_size, std::numeric_limits<float>::max(), -1.0f, text.c_str(), text.c_str() + text.length(), nullptr);
const ImVec2 text_pos(GetWindowWidth() - margin - text_size.x, position_y);
const bool bold_osd = GSConfig.OsdBoldText;
dl->AddText(font, font_size,
ImVec2(GetWindowWidth() - margin - text_size.x + shadow_offset, position_y + shadow_offset), IM_COL32(0, 0, 0, 100),
ImVec2(text_pos.x + shadow_offset, text_pos.y + shadow_offset), IM_COL32(0, 0, 0, 100),
text.c_str(), text.c_str() + text.length());
dl->AddText(font, font_size, ImVec2(GetWindowWidth() - margin - text_size.x, position_y), white_color,
dl->AddText(font, font_size, text_pos, white_color,
text.c_str(), text.c_str() + text.length());
if (bold_osd)
{
dl->AddText(font, font_size, ImVec2(text_pos.x + 0.6f, text_pos.y), white_color,
text.c_str(), text.c_str() + text.length());
}
}
__ri void ImGuiManager::DrawInputsOverlay(float scale, float margin, float spacing)
+1
View File
@@ -968,6 +968,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
SettingsWrapBitBool(OsdShowVideoCapture);
SettingsWrapBitBool(OsdShowInputRec);
SettingsWrapBitBool(OsdShowTextureReplacements);
SettingsWrapBitBool(OsdBoldText);
SettingsWrapBitBool(HWSpinGPUForReadbacks);
SettingsWrapBitBool(HWSpinCPUForReadbacks);