Monday, December 18, 2006

BitmapFont on Content-Pipeline

An old XNA Extras had used System.XML, but it becomes unable to use because XNA Framework doesn't allow to reference System.XML. But, we can use great solution using Content-Pipeline. I found it in this thread.

In this thread, new XNAExtras Aaron Leiby have posted is a very good solution. This may be the quickest bitmap font solution I have seen. This converted XNAExtras makes it possible to load XML files generated by bmfontgen with content-pipeline.

  1. Build XNABaseWin or Xbox.
  2. Modify the reference of XNAImport and build it.
  3. Double-click the property of your game project and add XNAImport.dll to your content-pipeline.
  4. Add XNABase.dll as the reference of your project.
  5. Change properties of your XML files generated by bmfontgen. XNA Content Pipeline is true, Content Importer is BitmapFontImporter, Content Font Processor is BitmapFontProcessor.

Now, you can load your bitmap font as the following:

BitmapFont bitmapFont = content.Load(asset_name);

No comments: