From 2eb36590dcfecdf8a18894395964152a0c0e9c2e Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 27 Jul 2026 21:02:38 -0500 Subject: [PATCH] Fix highlight height and underline location to be dpi aware. --- Source/Engine/UI/GUI/Common/RichTextBoxBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs index ff94a73f0..97e1d88a5 100644 --- a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs @@ -378,7 +378,7 @@ namespace FlaxEngine.GUI { var leftEdge = selection.StartIndex <= textBlock.Range.StartIndex ? textBlock.Bounds.UpperLeft : GetCharPosition(selection.StartIndex, out _); var rightEdge = selection.EndIndex >= textBlock.Range.EndIndex ? textBlock.Bounds.UpperRight : GetCharPosition(selection.EndIndex, out _); - float height = font.Height; + float height = font.Height / DpiScale; #if PLATFORM_MAC && !PLATFORM_SDL height /= (float)Platform.Dpi / 96.0f; // TODO: refactor DPI support on macOS to skip such hacks #endif @@ -431,7 +431,7 @@ namespace FlaxEngine.GUI if (textBlock.Style.UnderlineBrush != null) { var underLineHeight = 2.0f; - var height = font.Height; + var height = font.Height / DpiScale; var underlineRect = new Rectangle(textBlock.Bounds.Location.X, textBlock.Bounds.Location.Y + height - underLineHeight * 0.5f, textBlock.Bounds.Width, underLineHeight); textBlock.Style.UnderlineBrush.Draw(underlineRect, textBlock.Style.Color); }