Update: I’ve added three new things to my renderer.
- Measurement functions, so you can measure a string accounting for color codes.
-
TextRenderer.Defaultallows you to have a “default” instance of the text renderer class that can be used anywhere, which is important for: - Extension methods for
SpriteFontandSpriteBatch:-
SpriteFont.MeasureString(string text, float lineWidth)- measure a word-wrapped string, accounting for color codes, using this font. -
SpriteBatch.DrawColoredString(SpriteFont font, string text, Vector2 position, float lineWidth)- draw a multicolored string to this sprite batch at the given location with the given maximum line width.
-