From 09b58f46d9f7fb10b70325cc0b64c0e7f68df7ad Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 13 Jun 2010 21:42:14 +1200 Subject: [PATCH] remove some spikes --- OpenRA.Game/Graphics/SpriteFont.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index ea7979003c..d7d6ab612c 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -26,9 +26,15 @@ namespace OpenRA.Graphics // setup a 1-channel SheetBuilder for our private use if (builder == null) builder = new SheetBuilder(r, TextureChannel.Alpha); + PrecacheColor(Color.White); + PrecacheColor(Color.Red); + } + + void PrecacheColor(Color c) + { // precache glyphs for U+0020 - U+007f for (var n = (char)0x20; n < (char)0x7f; n++) - if (glyphs[Pair.New(n, Color.White)] == null) + if (glyphs[Pair.New(n, c)] == null) throw new InvalidOperationException(); }