1
0
mirror of synced 2025-02-07 06:31:24 +01:00

fix: Properly apply backing scaling to pixel perfect default font

This commit is contained in:
WerWolv 2025-01-26 14:18:20 +01:00
parent 0a0323ce5d
commit 8334fbb236
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ namespace hex::fonts {
Font addDefaultFont() {
auto &config = m_fontConfigs.emplace_back(m_defaultConfig);
config.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting;
config.SizePixels = std::max(1.0F, std::floor(ImHexApi::System::getGlobalScale() * 13.0F));
config.SizePixels = std::max(1.0F, std::floor(ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor() * 13.0F));
auto font = m_fontAtlas->AddFontDefault(&config);

View File

@ -55,7 +55,7 @@ namespace hex::fonts {
// If there's no custom font set, or it failed to load, fall back to the default font
if (!defaultFont.has_value()) {
if (pixelPerfectFont) {
fontSize = std::max(1.0F, std::floor(ImHexApi::System::getGlobalScale() * 13.0F));
fontSize = std::max(1.0F, std::floor(ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor() * 13.0F));
defaultFont = fontAtlas->addDefaultFont();
} else
defaultFont = fontAtlas->addFontFromRomFs("fonts/JetBrainsMono.ttf", fontSize, true, ImVec2());