diff --git a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs index 4880c23190..f5d3fa247f 100644 --- a/OpenRA.Mods.Common/Widgets/ButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ButtonWidget.cs @@ -11,6 +11,7 @@ using System; using System.Linq; +using OpenRA.Graphics; using OpenRA.Primitives; using OpenRA.Widgets; @@ -33,7 +34,6 @@ namespace OpenRA.Mods.Common.Widgets public string Background = "button"; public bool Depressed = false; public int VisualHeight = ChromeMetrics.Get("ButtonDepth"); - public int BaseLine = ChromeMetrics.Get("ButtonBaseLine"); public string Font = ChromeMetrics.Get("ButtonFont"); public Color TextColor = ChromeMetrics.Get("ButtonTextColor"); public Color TextColorDisabled = ChromeMetrics.Get("ButtonTextColorDisabled"); @@ -102,7 +102,6 @@ namespace OpenRA.Mods.Common.Widgets LeftMargin = other.LeftMargin; RightMargin = other.RightMargin; Font = other.Font; - BaseLine = other.BaseLine; TextColor = other.TextColor; TextColorDisabled = other.TextColorDisabled; Contrast = other.Contrast; @@ -243,10 +242,10 @@ namespace OpenRA.Mods.Common.Widgets var colordisabled = GetColorDisabled(); var bgDark = GetContrastColorDark(); var bgLight = GetContrastColorLight(); - var textSize = font.Measure(text); + var stateOffset = Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); - var position = GetTextPosition(textSize, rb); + var position = GetTextPosition(text, font, rb); var hover = Ui.MouseOverWidget == this || Children.Any(c => c == Ui.MouseOverWidget); DrawBackground(rb, disabled, Depressed, hover, highlighted); @@ -260,9 +259,10 @@ namespace OpenRA.Mods.Common.Widgets disabled ? colordisabled : color); } - int2 GetTextPosition(int2 textSize, Rectangle rb) + int2 GetTextPosition(string text, SpriteFont font, Rectangle rb) { - var y = rb.Y - BaseLine + (Bounds.Height - textSize.Y) / 2; + var textSize = font.Measure(text); + var y = rb.Y + (Bounds.Height - textSize.Y - font.TopOffset) / 2; switch (Align) { diff --git a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs index 2f106cd7c2..2d96c08328 100644 --- a/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs +++ b/OpenRA.Mods.Common/Widgets/CheckboxWidget.cs @@ -61,7 +61,9 @@ namespace OpenRA.Mods.Common.Widgets "checkbox"; WidgetUtils.DrawPanel(state, check); - var position = new float2(rect.Left + rect.Height * 1.5f, RenderOrigin.Y - BaseLine + (Bounds.Height - textSize.Y) / 2); + + var topOffset = font.TopOffset; + var position = new float2(rect.Left + rect.Height * 1.5f, RenderOrigin.Y + (Bounds.Height - textSize.Y - topOffset) / 2); if (Contrast) font.DrawTextWithContrast(text, position, diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index cf399d63b8..03a51c45b2 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -190,7 +190,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 36 Height: 20 - BaseLine: 1 Key: ReplaySpeedSlow TooltipText: Slow speed TooltipContainer: TOOLTIP_CONTAINER @@ -202,7 +201,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedRegular TooltipText: Regular speed TooltipContainer: TOOLTIP_CONTAINER @@ -214,7 +212,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedFast TooltipText: Fast speed TooltipContainer: TOOLTIP_CONTAINER @@ -226,7 +223,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedMax TooltipText: Maximum speed TooltipContainer: TOOLTIP_CONTAINER diff --git a/mods/cnc/chrome/playerprofile.yaml b/mods/cnc/chrome/playerprofile.yaml index c340c78869..9c5b1cc290 100644 --- a/mods/cnc/chrome/playerprofile.yaml +++ b/mods/cnc/chrome/playerprofile.yaml @@ -26,7 +26,6 @@ Container@LOCAL_PROFILE_PANEL: Width: 60 Height: 20 Font: TinyBold - BaseLine: 1 Text: Logout Background@BADGES_CONTAINER: Width: PARENT_RIGHT @@ -65,7 +64,6 @@ Container@LOCAL_PROFILE_PANEL: Width: 240 Height: 20 Font: TinyBold - BaseLine: 1 Text: Connect to an OpenRA forum account Background@GENERATING_KEYS: Width: PARENT_RIGHT @@ -123,7 +121,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Cancel Button@CHECK_KEY: @@ -131,7 +128,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Continue Background@CHECKING_FINGERPRINT: @@ -183,7 +179,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Back Background@CONNECTION_ERROR: @@ -210,7 +205,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Retry diff --git a/mods/common/chrome/ingame-observer.yaml b/mods/common/chrome/ingame-observer.yaml index bffd5c172e..7cfb3f6507 100644 --- a/mods/common/chrome/ingame-observer.yaml +++ b/mods/common/chrome/ingame-observer.yaml @@ -125,7 +125,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 36 Height: 20 - BaseLine: 1 Key: ReplaySpeedSlow TooltipText: Slow speed TooltipContainer: TOOLTIP_CONTAINER @@ -136,7 +135,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedRegular TooltipText: Regular speed TooltipContainer: TOOLTIP_CONTAINER @@ -147,7 +145,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedFast TooltipText: Fast speed TooltipContainer: TOOLTIP_CONTAINER @@ -158,7 +155,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedMax TooltipText: Maximum speed TooltipContainer: TOOLTIP_CONTAINER diff --git a/mods/common/chrome/playerprofile.yaml b/mods/common/chrome/playerprofile.yaml index c8a4986fa2..4175076ecf 100644 --- a/mods/common/chrome/playerprofile.yaml +++ b/mods/common/chrome/playerprofile.yaml @@ -26,7 +26,6 @@ Container@LOCAL_PROFILE_PANEL: Width: 60 Height: 20 Font: TinyBold - BaseLine: 1 Text: Logout Background@BADGES_CONTAINER: Width: PARENT_RIGHT @@ -65,7 +64,6 @@ Container@LOCAL_PROFILE_PANEL: Width: 240 Height: 20 Font: TinyBold - BaseLine: 1 Text: Connect to an OpenRA forum account Background@GENERATING_KEYS: Width: PARENT_RIGHT @@ -123,7 +121,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Cancel Button@CHECK_KEY: @@ -131,7 +128,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Continue Background@CHECKING_FINGERPRINT: @@ -183,7 +179,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Back Background@CONNECTION_ERROR: @@ -210,7 +205,6 @@ Container@LOCAL_PROFILE_PANEL: Y: 70 Width: 70 Height: 20 - BaseLine: 1 Font: TinyBold Text: Retry diff --git a/mods/common/metrics.yaml b/mods/common/metrics.yaml index 3d4c68a01c..df1aff28bf 100644 --- a/mods/common/metrics.yaml +++ b/mods/common/metrics.yaml @@ -1,5 +1,4 @@ Metrics: - ButtonBaseLine: 0 ButtonDepth: 1 ButtonFont: Regular ButtonTextColor: FFFFFF diff --git a/mods/modcontent/metrics.yaml b/mods/modcontent/metrics.yaml index f1d27b6522..8d8d57f042 100644 --- a/mods/modcontent/metrics.yaml +++ b/mods/modcontent/metrics.yaml @@ -1,7 +1,6 @@ # General dumping-ground for UI element sizes, etc. Metrics: - ButtonBaseLine: 2 ButtonDepth: 0 ButtonFont: Bold CheckboxPressedState: true diff --git a/mods/ra/chrome/ingame-observer.yaml b/mods/ra/chrome/ingame-observer.yaml index e3b4a04a3a..18bc4e4fc1 100644 --- a/mods/ra/chrome/ingame-observer.yaml +++ b/mods/ra/chrome/ingame-observer.yaml @@ -150,7 +150,6 @@ Container@OBSERVER_WIDGETS: Y: 8 Width: 42 Height: 22 - BaseLine: 1 Background: sidebar-button-observer Key: ReplaySpeedSlow TooltipText: Slow speed @@ -163,7 +162,6 @@ Container@OBSERVER_WIDGETS: Y: 8 Width: 42 Height: 22 - BaseLine: 1 Background: sidebar-button-observer Key: ReplaySpeedRegular TooltipText: Regular speed @@ -176,7 +174,6 @@ Container@OBSERVER_WIDGETS: Y: 8 Width: 42 Height: 22 - BaseLine: 1 Background: sidebar-button-observer Key: ReplaySpeedFast TooltipText: Fast speed @@ -189,7 +186,6 @@ Container@OBSERVER_WIDGETS: Y: 8 Width: 42 Height: 22 - BaseLine: 1 Background: sidebar-button-observer Key: ReplaySpeedMax TooltipText: Maximum speed diff --git a/mods/ts/chrome/ingame-observer.yaml b/mods/ts/chrome/ingame-observer.yaml index 1426c463d6..11be6f60ae 100644 --- a/mods/ts/chrome/ingame-observer.yaml +++ b/mods/ts/chrome/ingame-observer.yaml @@ -125,7 +125,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 36 Height: 20 - BaseLine: 1 Key: ReplaySpeedSlow TooltipText: Slow speed TooltipContainer: TOOLTIP_CONTAINER @@ -136,7 +135,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedRegular TooltipText: Regular speed TooltipContainer: TOOLTIP_CONTAINER @@ -147,7 +145,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedFast TooltipText: Fast speed TooltipContainer: TOOLTIP_CONTAINER @@ -158,7 +155,6 @@ Container@OBSERVER_WIDGETS: Y: 13 Width: 38 Height: 20 - BaseLine: 1 Key: ReplaySpeedMax TooltipText: Maximum speed TooltipContainer: TOOLTIP_CONTAINER