impr: Store points instead of pixels for font size in settings

This commit is contained in:
WerWolv 2025-08-23 20:56:34 +02:00
parent fc2ed47676
commit 0e800723f5
2 changed files with 3 additions and 9 deletions

View File

@ -73,7 +73,7 @@ namespace hex::fonts {
class FontSelector : public ContentRegistry::Settings::Widgets::Widget {
public:
FontSelector() : m_fontSize(ImHexApi::Fonts::pointsToPixels(12), 2, 100), m_bold(false), m_italic(false) { }
FontSelector() : m_fontSize(12, 2, 100), m_bold(false), m_italic(false) { }
bool draw(const std::string &name) override;

View File

@ -199,15 +199,9 @@ namespace hex::fonts {
}
bool SliderPoints::draw(const std::string &name) {
float value = ImHexApi::Fonts::pixelsToPoints(m_value);
float min = ImHexApi::Fonts::pixelsToPoints(m_min);
float max = ImHexApi::Fonts::pixelsToPoints(m_max);
if (ImGui::SliderFloat(name.c_str(), &value, min, max, "%.0f pt"))
if (ImGui::SliderFloat(name.c_str(), &m_value, m_min, m_max, "%.0f pt"))
m_changed = true;
m_value = ImHexApi::Fonts::pointsToPixels(value);
if (m_changed && !ImGui::IsItemActive()) {
m_changed = false;
return true;
@ -287,7 +281,7 @@ namespace hex::fonts {
}
[[nodiscard]] float FontSelector::getFontSize() const {
return m_fontSize.getValue();
return ImHexApi::Fonts::pointsToPixels(m_fontSize.getValue());
}
[[nodiscard]] bool FontSelector::isBold() const {