Nuclex.Fonts: Overview

Example of Nuclex.Fonts' text rendering capabilities

Nuclex.Fonts fills this gap with a proper text rendering system that seamlessly integrates into the content pipeline.

The font importer integrates with the XNA build process, so there are no external utilities involved. Just add an XML file with import instructions to your project for any font you want to have available in your XNA application and compile. A platform independent .xnb file will be generated (the exact same way it happens when you add a bitmap or effect to your project).

You can then load your font like any other asset using XNA's ContentManager:

protected override void LoadGraphicsContent(bool loadAllContent) {
  if(loadAllContent) {
    this.myFont = this.content.Load<BitmapFont>("Content/Arial");
  }
}

Drawing text to the screen has never been easier:

protected override void Draw(GameTime gameTime) {
  graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

  this.myFont.DrawString(new Vector2(100.0f, 100.0f), "Hello World!");
}

Nuclex.Fonts is freeware and can be used in any kind of application, including commerical software.