From 9a0d4ae53b6e1130c28a63b46cea51af6da93da3 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 27 Mar 2022 01:50:17 +0200 Subject: [PATCH] Improve font rendering and alignment with custom DPI --- Source/Engine/Render2D/Render2D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Render2D/Render2D.cpp b/Source/Engine/Render2D/Render2D.cpp index 779746d8d..8c6760ba8 100644 --- a/Source/Engine/Render2D/Render2D.cpp +++ b/Source/Engine/Render2D/Render2D.cpp @@ -1331,7 +1331,7 @@ void Render2D::DrawText(Font* font, const StringView& text, const Color& color, { // Calculate character size and atlas coordinates const float x = pointer.X + entry.OffsetX * scale; - const float y = pointer.Y + (font->GetHeight() + font->GetDescender() - entry.OffsetY) * scale; + const float y = pointer.Y - entry.OffsetY * scale + Math::Ceil((font->GetHeight() + font->GetDescender()) * scale); Rectangle charRect(x, y, entry.UVSize.X * scale, entry.UVSize.Y * scale); charRect.Offset(layout.Bounds.Location);