fix: Icon scaling when using pixel perfect font

This commit is contained in:
WerWolv
2025-05-11 17:42:36 +02:00
parent 431eab47a2
commit 5a095cc993
2 changed files with 7 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ namespace hex::fonts {
if (fontName.find("icon") != std::string::npos)
actualFontSize = ImHexApi::Fonts::pointsToPixels(fontSize);
else
actualFontSize = fontSize;
actualFontSize = fontSize;
if (FT_Set_Pixel_Sizes(face, actualFontSize, actualFontSize) != 0) {
log::fatal("Failed to set pixel size");
@@ -187,7 +187,7 @@ 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() * ImHexApi::System::getBackingScaleFactor() * 13.0F));
realFontSize = fontSize = std::max(1.0F, std::floor(ImHexApi::System::getBackingScaleFactor() * 13.0F));
defaultFont = fontAtlas->addDefaultFont();
std::string defaultFontName = "Proggy Clean";
memcpy(fontAtlas->getAtlas()->ConfigData[fontIndex].Name, defaultFontName.c_str(), defaultFontName.size());