mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Better font scaling with larger backing scale factors
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -65,12 +65,12 @@ namespace hex::fonts {
|
||||
return;
|
||||
}
|
||||
|
||||
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale());
|
||||
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
||||
});
|
||||
|
||||
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale());
|
||||
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
||||
EventDPIChanged::subscribe(font, [&widget, name, &font](float, float newScaling) {
|
||||
loadFont(widget.getWidget(), name, &font, newScaling);
|
||||
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale() * newScaling);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user