diff --git a/OpenRA.Game/Graphics/Renderer.cs b/OpenRA.Game/Graphics/Renderer.cs index 0f0f48eb3b..5a3c6fd7e0 100644 --- a/OpenRA.Game/Graphics/Renderer.cs +++ b/OpenRA.Game/Graphics/Renderer.cs @@ -35,7 +35,7 @@ namespace OpenRA.Graphics public ITexture PaletteTexture; - public readonly SpriteFont RegularFont, BoldFont, TitleFont, TinyFont, TinyBoldFont; + public readonly SpriteFont RegularFont, BoldFont, TitleFont, TinyFont, TinyBoldFont, BigBoldFont; internal const int TempBufferSize = 8192; const int TempBufferCount = 8; @@ -57,6 +57,7 @@ namespace OpenRA.Graphics RegularFont = new SpriteFont("FreeSans.ttf", 14); BoldFont = new SpriteFont("FreeSansBold.ttf", 14); TitleFont = new SpriteFont("titles.ttf", 48); + BigBoldFont = new SpriteFont("FreeSansBold.ttf", 24); TinyFont = new SpriteFont("FreeSans.ttf", 10); TinyBoldFont = new SpriteFont("FreeSansBold.ttf", 10); diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 227e41e0f5..d08721022e 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -19,11 +19,13 @@ namespace OpenRA.Widgets { public enum TextAlign { Left, Center, Right } public enum TextVAlign { Top, Middle, Bottom } + public enum LabelFont { Regular, Bold, Title, Tiny, TinyBold, BigBold } public string Text = null; public string Background = null; public TextAlign Align = TextAlign.Left; public TextVAlign VAlign = TextVAlign.Middle; + public LabelFont Font = LabelFont.Regular; public bool Bold = false; public bool Contrast = false; public bool WordWrap = false; @@ -54,8 +56,30 @@ namespace OpenRA.Widgets if (bg != null) WidgetUtils.DrawPanel(bg, RenderBounds ); - - var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; + + if (Font == LabelFont.Regular && Bold) + Font = LabelFont.Bold; + + // TODO: Hardcoded font types are stupid + SpriteFont font = Game.Renderer.RegularFont; + switch (Font) + { + case LabelFont.Bold: + font = Game.Renderer.BoldFont; + break; + case LabelFont.Tiny: + font = Game.Renderer.TinyFont; + break; + case LabelFont.TinyBold: + font = Game.Renderer.TinyBoldFont; + break; + case LabelFont.Title: + font = Game.Renderer.TitleFont; + break; + case LabelFont.BigBold: + font = Game.Renderer.BigBoldFont; + break; + } var text = GetText(); if (text == null) return;