While working on Iron Roads today, I tried to use the custom font Radius (a free font from Urban Fonts.) I like how the letters look like curving tracks you might see on a draftsman’s drawing or surveying map. It has potential for the Iron Roads logo. Anyway, I ran into a tricky problem that stumped me for a long while.
I followed the normal procedure as Microsoft describes in Drawing Text with a Sprite:
- Right-click your Content project in Solution Explorer, click Add, and then click New Item.
- In the Add New Item dialog box, click Sprite Font. You may find it convenient at this point to change the name of the new file from “SpriteFont1” to the friendly name of the font you intend to load (keeping the .spritefont file extension). The friendly name identifies the font once it is installed on your computer, for example, “Courier New” or “Times New Roman.” When you reference the font in your code, you must use the friendly name you have assigned it. XNA Game Studio creates a new .spritefont file for your font and opens it.
At this point I had what I needed, but alas, it wouldn’t compile, complaining:
The font family “Radius” could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.
Took me a long while to figure it out, but it’s actually quite simple. Install new fonts before starting up Visual Studio! So, all I had to do was shut VS2010 down and start her up again, an Voila! New beautiful font displaying in my game!!!
Please note, this is a concept piece, not art assets are my original and I don’t claim copyright to them.