• Create Account

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1Alphablackwolf  Members   -  Reputation: 101

Like
0Likes
Like

Posted 07 May 2012 - 04:31 PM

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.

### #2BCullis  Crossbones+   -  Reputation: 1700

Like
0Likes
Like

Posted 07 May 2012 - 06:07 PM

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.

Hazard Pay :: FPS/RTS in SharpDX
DeviantArt :: Because right-brain needs love too

### #3Alphablackwolf  Members   -  Reputation: 101

Like
0Likes
Like

Posted 07 May 2012 - 06:18 PM

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?

### #4Alphablackwolf  Members   -  Reputation: 101

Like
0Likes
Like

Posted 08 May 2012 - 07:26 AM

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:

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.

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.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS