6
\$\begingroup\$

I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e:

<FontName>Kootenay</FontName>

or

<FontName>Arial</FontName>

No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA. My problem is, I cant use them, I got this error:

The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.

So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!

\$\endgroup\$
1
  • \$\begingroup\$ problem solved, just like zacharmarz said \$\endgroup\$
    – Zukki
    Feb 12, 2011 at 19:32

3 Answers 3

5
\$\begingroup\$

If you see your font in fonts directory, just try to restart Visual Studio or whole system. It should help.

I tried it - I installed new font, add it into running MSVS project, then compile and get the same error as you. When I restarted MSVS and compile again, it worked.

\$\endgroup\$
2
  • \$\begingroup\$ indeed, now works perfect! asked yesterday, turned off the pc and now today the fonts are working \$\endgroup\$
    – Zukki
    Feb 12, 2011 at 19:31
  • \$\begingroup\$ @Zukki: A good way to thank zacharmarz shall be to upvote his answer, and click the check on the left-hand side of his answer so that you mark it as the accepted answer, that is, the answer that solved your problem. Not only will you help zacharmarz by incrementing his reputation points which is encouraging, but you will also point the evidence that zacharmarz's answer is the very solution for this problem to other GD users who should look for a similar problem as yours. I hope you will enjoy GD! =) \$\endgroup\$ Feb 13, 2011 at 0:40
1
\$\begingroup\$

Try putting the font file in the same directory as your spritefont file.

\$\endgroup\$
1
\$\begingroup\$

It appears the problem is this: XNA claims to support Truetype and Opentype fonts. However, some Opentype fonts have Postscript outlines, which XNA doesn't support. So they won't import. One example is Philosopher, an otf font which doesn't have compatible outlines.

The solution is to convert the font to Truetype. The font I mentioned won't work in XNA, but after converting it to ttf with this online tool, it does. Make sure you delete the old font from Control Panel/Fonts to avoid confusion.

Moreover, restarting the OS is unnecessary. Restarting VS is sufficient.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .