From 0e3d343f153d1a331bb0965fd302155f9688afa9 Mon Sep 17 00:00:00 2001 From: teinarss Date: Thu, 2 May 2019 19:44:52 +0200 Subject: [PATCH] VAlign correctly in LabelWidget --- OpenRA.Mods.Common/Widgets/LabelWidget.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/LabelWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWidget.cs index 7484d34c44..65021f60bf 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWidget.cs @@ -49,6 +49,7 @@ namespace OpenRA.Mods.Common.Widgets { Text = other.Text; Align = other.Align; + VAlign = other.VAlign; Font = other.Font; TextColor = other.TextColor; Contrast = other.Contrast; @@ -74,9 +75,13 @@ namespace OpenRA.Mods.Common.Widgets var textSize = font.Measure(text); var position = RenderOrigin; + var offset = font.TopOffset; + + if (VAlign == TextVAlign.Top) + position += new int2(0, -offset); if (VAlign == TextVAlign.Middle) - position += new int2(0, (Bounds.Height - textSize.Y) / 2); + position += new int2(0, (Bounds.Height - textSize.Y - offset) / 2); if (VAlign == TextVAlign.Bottom) position += new int2(0, Bounds.Height - textSize.Y);