SpriteFont

The class is a convenient way to draw text. It works with the SpriteBatch class.

Note

After a font asset is compiled it can be loaded as a instance using the @'Xenko.Core.Serialization.Assets.ContentManager'. It contains all the options to display a text (bitmaps, kerning, line spacing etc).

Once the font is loaded, you can display any text with a SpriteBatch. The @'Xenko.Graphics.SpriteBatch.DrawString' method performs the draw. For more information about the SpriteBatch, see the page.

The various overloads let you specify the text's orientation, scale, depth, origin, etc. You can also apply some SpriteEffects to the text:

  • None
  • FlipVertically
  • FlipBothCode: Advanced text drawing