Workaround for Using TrueType Fonts

Hello everyone! Today I was looking to learn how to add TrueType (TTF) fonts to my game. I followed the documentation on the matter (available here), but the Pipeline Tool kept failing to load the TTF file. A few hours later I came up with a workaround to the issue and posted it on my website.

Hopefully this can help some of you trying to load in TTF fonts. If anyone has a better solution, I’d really like to hear it. Thanks!

Humm normally how i do it is as follows.

Download a TTF or make one.
Double click it so as to install it to the OS.
Open up the file Explorer and type shell:fonts (in the file path bar) make sure it is in the folder that pops up.
open up the content pipeline tool click add new item.
(there are two options to choose from at this point localized spritefont and spritefont).

click spritefont as above not the localized one name and create it.
open it up then type the name of the ttf in for the fontname

.
if that doesn’t work it could be that the internal name of the font is different ive only seen this a few times.
In that case you can download a program called truetype explorer to see all the data in the font which is free but a obscure utility program. though you should be able to then see the actual font name inside you could then rename the file itself to its correct name.

The easiest way to work with fonts in MonoGame is with SpriteFontPlus: https://github.com/rds1983/SpriteFontPlus

2 Likes

Thanks for the ideas @willmotil and @Apostolique. I will definitely have to check out SpriteFontPlus. Usually I prefer to use a TTF file without installing it (that way my system fonts don’t get bloated over time.) If I decide to use a font I’ve installed, I will give your process a try, @willmotil. I’m not sure why the pipeline tool fails to figure out what to do with TTF fonts, but hopefully it’s something that will be addressed in the future. Thanks again for your suggestions!