1
0
mirror of synced 2024-12-01 02:37:18 +01:00

fix: Force scaling of default font to be a integer multiple

This commit is contained in:
WerWolv 2024-01-03 18:26:48 +01:00
parent ed8934882e
commit c402d58685
2 changed files with 2 additions and 1 deletions

View File

@ -230,6 +230,7 @@ namespace hex::plugin::builtin {
if (fontFile.empty()) { if (fontFile.empty()) {
defaultConfig.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting; defaultConfig.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting;
defaultConfig.SizePixels = std::floor(ImHexApi::Fonts::getFontSize() / ImHexApi::Fonts::DefaultFontSize) * ImHexApi::Fonts::DefaultFontSize;
defaultFont = fonts->AddFontDefault(&defaultConfig); defaultFont = fonts->AddFontDefault(&defaultConfig);
} else { } else {
defaultFont = fonts->AddFontFromFileTTF(wolv::util::toUTF8String(fontFile).c_str(), 0, &defaultConfig, defaultGlyphRanges.Data); defaultFont = fonts->AddFontFromFileTTF(wolv::util::toUTF8String(fontFile).c_str(), 0, &defaultConfig, defaultGlyphRanges.Data);

View File

@ -166,7 +166,7 @@ namespace hex::plugin::builtin {
bool draw(const std::string &name) override { bool draw(const std::string &name) override {
auto format = [this] -> std::string { auto format = [this] -> std::string {
if (m_value == 0) if (m_value == 0)
return "hex.builtin.setting.interface.scaling.native"_lang; return "hex.builtin.setting.interface.scaling.native"_lang + hex::format(" (x{:.1f})", ImHexApi::System::getNativeScale());
else else
return "x%.1f"; return "x%.1f";
}(); }();