fix: Unifont glyphs being rendered too far down

This commit is contained in:
WerWolv
2025-05-24 16:09:15 +02:00
parent 7acc5fc02e
commit c69a7012c5

View File

@@ -218,11 +218,16 @@ namespace hex::fonts {
if (font.defaultSize.has_value())
fontSize = font.defaultSize.value() * ImHexApi::System::getBackingScaleFactor();
const ImVec2 offset = { font.offset.x, font.offset.y + ImCeil(4_scaled) };
ImVec2 offset = { font.offset.x, font.offset.y };
bool scalable = font.scalable.value_or(true);
if (scalable) {
offset.y += ImCeil(3_scaled);
}
fontAtlas->addFontFromMemory(font.fontData, fontSize, !font.defaultSize.has_value(), offset, glyphRanges.back());
if (!font.scalable.value_or(true)) {
if (!scalable) {
std::string fontName = "NonScalable";
auto nameSize = fontName.size();
memcpy(fontAtlas->getAtlas()->ConfigData[fontIndex].Name, fontName.c_str(), nameSize);