1
0
mirror of synced 2025-01-29 19:17:28 +01:00

ui: Increase window size when a bigger font is being used

This commit is contained in:
WerWolv 2022-08-16 11:49:07 +02:00
parent 0c0caf6942
commit aa01d58b33
3 changed files with 4 additions and 2 deletions

View File

@ -210,6 +210,7 @@ namespace hex {
std::map<std::string, std::string> &getInitArguments();
constexpr static float DefaultFontSize = 13.0;
const std::fs::path &getCustomFontPath();
float getFontSize();

View File

@ -455,7 +455,8 @@ namespace hex {
continue;
if (view->isAvailable()) {
ImGui::SetNextWindowSizeConstraints(scaled(view->getMinSize()), scaled(view->getMaxSize()));
float fontScaling = std::max(1.0F, ImHexApi::System::getFontSize() / ImHexApi::System::DefaultFontSize);
ImGui::SetNextWindowSizeConstraints(view->getMinSize() * fontScaling, view->getMaxSize() * fontScaling);
view->drawContent();
}

View File

@ -484,7 +484,7 @@ namespace hex::plugin::builtin {
}
// If a custom font has been loaded now, also load the font size
float fontSize = 13.0F * ImHexApi::System::getGlobalScale();
float fontSize = ImHexApi::System::DefaultFontSize * ImHexApi::System::getGlobalScale();
if (!fontFile.empty()) {
ImHexApi::System::impl::setCustomFontPath(fontFile);