No Spritefont Template - Workaround?

Is Spritefont still supported? I’ve been searching the net and trying different suggestions, but still don’t have Spritefont available.
I tried what I thought could be a workaround - downloaded a ttf file, and loaded from content - but got an error. Does MG support TrueTypeFont? Would this method work if I used another font type? Or do I definitely need to get SpriteFont?

I noticed a thread referencing to a SpriteFont 2 installer , which I downloaded. Would this work? If I install it, do I the select ‘Add Existing Item’, and navigate to the folder it installs to? …not sure what to do.

I don’t know what environment you use, but here is what I do in VS:

  1. Open the pipeline tool (double-click Content.mgcb)
  2. Create a new SpriteFont (my_font.spritefont)
  3. Edit the xml however you want
  4. File->Rebuild and then add the resultant XNB file to the project under the Content folder.

Note: The build breaks if the my_font.spritefont file is in the Content folder - it needs just the my_font.xnb file. There may be ways to fix this through VS configuration, but I don’t know of them.


This is as far as I can get. I don’t seem to have an app to edit it. Could you tell me what editor you use? Also, I noticed my items are limited in comparison to yours - not only yours, but others I have seen. Where can I get the effects items? Thanks

It creates a .spritefont file, which is an XML file. If you open this file in a text editor or in Visual Studio, you can edit the font name and point size. This is how it was done in XNA as well. We are discussing in another thread about the best approach to make a spritefont editor to provide a small GUI for this file to make it easier to edit.

Thanks very much, That did work,
Is there a documentation on this, because I have not seen any with this approach? Also, you didn’t tell me where or how I can get the effects items.

I’m using Windows with Visual Studio and the official release of MonoGame 3.4 - everything is default settings for me. I can’t say why you have fewer options - a different platform, tools, or version, I presume.

The official documentation:
http://www.monogame.net/documentation/?page=Using_The_Pipeline_Tool

This post by KonajuGames could be adapted/added to the official documentation:


It wasn’t clear to me how everything fits in with VS until I saw it.

I had read through that whole section, and I had been using the Content.mgcb, but there was nothing on SpriteFont, and I searched again, and found nothing. The reason I didn’t see the SpriteFont item was because I was only using ‘Add Existing Item’. However, Now I know where to find it.
I am using the latest MonoGame on VS2013 on a Windows Phone 8 XAML project. Like you said, maybe it is the platform, or it could be you are using VS2010.
Anyways, I appreciate the help.

I’m having problems as well. I’ve added the .spritefont file to content.mgcb. I also have the XNB files created. I’m having problems with the pipeline content tool crashing when I try building after adding an existing spritefont file. If I go to add new spritefont in the pipeline tool it works but when trying to load during runtime I get an error: “Could not load asset as a non-content file!”. Just really stuck at this point and would appreciate any help.

Edit: I’m using visual studio 2013 on Windows 7 and Windows 8.1. Same issue happens on both computers. I’m building the project for Windows.

Double Edit: I figured it out. I wasn’t using the correct content manager.

I don’t know how to help you with that. I was getting that error message when I tried loading other files before. What I could suggest you do is, start a new project, and just try loading the spritefont to see if the problem might be caused by something else.
I am assuming your code looks something like this:

public class Game1 : Game
    {
        SpriteFont myFont;

        protected override void LoadContent()
        {
             myFont = Content.Load<SpriteFont>("testFont");
        }
    }

Other than that, I would suggest you post your question as a new post, because it is slightly different to this post, which will allow you to get more of a response, and since no one seems to be responding to this one anymore. Hope you get through. I know how it feels to be stuck on something that causes you to wonder why it is not working. Xna is harder than I thought though.