fix: Icon size being off when using fractional scaling with default font

This commit is contained in:
WerWolv 2024-05-18 19:39:29 +02:00
parent 6b6a6ae5f0
commit d078f9d847
1 changed files with 2 additions and 1 deletions

View File

@ -229,8 +229,9 @@ namespace hex::plugin::builtin {
std::strncpy(defaultConfig.Name, fontName, sizeof(defaultConfig.Name) - 1);
if (fontFile.empty()) {
fontSize = std::floor(ImHexApi::Fonts::getFontSize() / ImHexApi::Fonts::DefaultFontSize) * ImHexApi::Fonts::DefaultFontSize;
defaultConfig.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Monochrome | ImGuiFreeTypeBuilderFlags_MonoHinting;
defaultConfig.SizePixels = std::floor(ImHexApi::Fonts::getFontSize() / ImHexApi::Fonts::DefaultFontSize) * ImHexApi::Fonts::DefaultFontSize;
defaultConfig.SizePixels = fontSize;
defaultFont = fonts->AddFontDefault(&defaultConfig);
} else {
defaultFont = fonts->AddFontFromFileTTF(wolv::util::toUTF8String(fontFile).c_str(), 0, &defaultConfig, defaultGlyphRanges.Data);