public DynamicSpriteFont GetFont(int fontSize) { DynamicSpriteFont result; if (_fonts.TryGetValue(fontSize, out result)) { return(result); } if (_fontSources.Count == 0) { throw new Exception("Could not create a font without a single font source. Use AddFont to add at least one font source."); } var fontSource = _fontSources[0]; int ascent, descent, lineHeight; fontSource.GetMetricsForSize(fontSize, out ascent, out descent, out lineHeight); result = new DynamicSpriteFont(this, fontSize, lineHeight); _fonts[fontSize] = result; return(result); }
public static float DrawString(this SpriteBatch batch, DynamicSpriteFont font, StringBuilder text, Vector2 pos, Color[] colors, float depth = 0.0f) { return(font.DrawText(batch, text, pos, colors, depth)); }
public static float DrawString(this SpriteBatch batch, DynamicSpriteFont font, string text, Vector2 pos, Color color, Vector2 scale, float depth = 0.0f) { return(font.DrawText(batch, text, pos, color, scale, depth)); }