impr: Better font scaling with larger backing scale factors

This commit is contained in:
WerWolv
2025-01-25 22:27:59 +01:00
parent 93e5d62782
commit 93f1f5d076
7 changed files with 38 additions and 24 deletions

View File

@@ -55,8 +55,8 @@ 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));
defaultFont = fontAtlas->addDefaultFont();
fontSize = std::floor(fontAtlas->getAdjustedFontSize(ImHexApi::System::getGlobalScale() * 13.0F));
} else
defaultFont = fontAtlas->addFontFromRomFs("fonts/JetBrainsMono.ttf", fontSize, true, ImVec2());