mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
feat: Added DPI awareness on Windows, added FiraCode as optional default font
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <hex/api/imhex_api.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/api/event_manager.hpp>
|
||||
#include <hex/api_urls.hpp>
|
||||
|
||||
#include <hex/api/task_manager.hpp>
|
||||
@@ -98,15 +99,20 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
bool configureUIScale() {
|
||||
int interfaceScaleSetting = int(ContentRegistry::Settings::read<float>("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling_factor", 1.0F) * 10.0F);
|
||||
EventDPIChanged::subscribe([](float, float newScaling) {
|
||||
int interfaceScaleSetting = int(ContentRegistry::Settings::read<float>("hex.builtin.setting.interface", "hex.builtin.setting.interface.scaling_factor", 0.0F) * 10.0F);
|
||||
|
||||
float interfaceScaling;
|
||||
if (interfaceScaleSetting == 0)
|
||||
interfaceScaling = ImHexApi::System::getNativeScale();
|
||||
else
|
||||
interfaceScaling = interfaceScaleSetting / 10.0F;
|
||||
float interfaceScaling;
|
||||
if (interfaceScaleSetting == 0)
|
||||
interfaceScaling = newScaling;
|
||||
else
|
||||
interfaceScaling = interfaceScaleSetting / 10.0F;
|
||||
|
||||
ImHexApi::System::impl::setGlobalScale(interfaceScaling);
|
||||
ImHexApi::System::impl::setGlobalScale(interfaceScaling);
|
||||
});
|
||||
|
||||
const auto nativeScale = ImHexApi::System::getNativeScale();
|
||||
EventDPIChanged::post(nativeScale, nativeScale);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user