• ### Popular Now

• 15
• 15
• 11
• 9
• 10

This topic is 2146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am having trouble loading a spritefont for Trajan Pro. I downloaded/installed the font (multiple times/ways now) and have restarted both my machine and visual studio many times, but I still get a build error telling me that it cannot find the 'Trajan Pro' font family. It's in the font folder, both regular and bold. I've tried every spelling of 'Trajan Pro' I can think of, and cannot get it to work.

I even tried running through the .net library of available font families, and I noted several ones that were in my font folder, but did not show up, Trajan Pro was among them.

The code I used to show font family (in a winforms project, not xna):

 Dim family As FontFamily For Each family In FontFamily.Families debug.Print(family.Name) Next 

Does anyone know how visual studio/XNA loads in these fonts? Is there any way I can make this work? Any help would be greatly appreciated.

##### Share on other sites
Are you sure you're using the "friendly name" of the font that Windows recognizes? This doesn't necessarily match the font filename. And it's a TrueType font, .ttf, right?

More from MSDN re: the FontName tag in the .spritefont file:
The name of the font to be imported. This is not the name of a font file, but rather the friendly name that identifies the font once it is installed on your computer. You can use the Fonts folder in Control Panel to see the names of fonts installed on your system, and to install new ones as well. The Content Pipeline supports the same fonts as the System.Drawing.Font class, including TrueType fonts, but not bitmap (.fon) fonts.[/quote]

##### Share on other sites
It's an open type font, but the error specifically states that it has to be open type or true type, so it's covered there. I am mostly attempting to use the name "Trajan Pro" with any variation I can think of. The 'friendly name' as far as I can tell is Trajan Pro according to the font folder and notepad/wordpad/word, etc. Which all show Trajan Pro as an option and work. Hmm... is there any way to load the font directly from the file, say if I include it in the project directory?

##### Share on other sites
Aha! Found it. So apparently some OpenType Font setups will not work. It's a misleading error message. To quote an exerpt from where I found my answer:

[color=#4A4A4A][background=rgb(241, 241, 241)]The OpenType requirement is a bit misleading as the font has to have TrueType outlines; OpenType also supports PostScript outlines which do not work in GDI+, which is what the SpriteFont processor internally uses.[/background][/quote]

So I did an online conversion from otf to ttf and reinstalled my fonts with the TTF files, once I restarted visual studio again after that, it worked.