
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:
if(loadAllContent) {
this.myFont = this.content.Load<BitmapFont>("Content/Arial");
}
}
Drawing text to the screen has never been easier:
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.