5
\$\begingroup\$

I've been trying to get this to work for the last 2 hours and I'm not getting what I'm doing wrong...

I've added Nuclex.TrueTypeImporter to my references in my content and I've added Nuclex.Fonts & Nuclex.Graphics in my main project.

I've put Arial-24-Vector.spritefont & Lindsey.spritefont in the root of my content directory.

_spriteFont = Content.Load<SpriteFont>("Lindsey"); // works

_testFont = Content.Load<VectorFont>("Arial-24-Vector"); // crashes

I get this error on the _testFont line:

File contains Microsoft.Xna.Framework.Graphics.SpriteFont but trying to load as Nuclex.Fonts.VectorFont.

So I've searched around and by the looks of it it has something to do with the content importer & the content processor. For the content importer I have no new choices, so I leave it as it is, Sprite Font Description - XNA Framework for content processor and I select Vector Font - Nuclex Framework And then I try to run it.

_testFont = Content.Load<VectorFont>("Arial-24-Vector"); // crashes again

I get the following error

Error loading "Arial-24-Vector".

It does work if I load a sprite, so it's not a pathing problem. I've checked the samples, they do work, but I think they also use a different version of the XNA framework because in my version the "Content" class starts with a capital letter.

I'm at a loss, so I ask here.

Edit:

Something super weird is going on. I've just added the following two lines to a method inside FreeTypeFontProcessor::FreeTypeFontProcessor( Microsoft::Xna::Framework::Content::Pipeline::Graphics::FontDescription ^fontDescription, FontHinter hinter, just to check if code would even get there:

System::Console::WriteLine("I AM HEEREEE");
System::Console::ReadLine();

So, I compile it, put it in my project, I run it and... it works! What the hell?? This is weird because I've downloaded the binaries, they didn't work, I've compiled the binaries myself. didn't work either, but now I make a small change to the code and it works? >_>.

So, now I remove the two lines, compile it again and it works again. Someone care to elaborate what is going on? Probably some weird caching problem!

\$\endgroup\$
3
  • \$\begingroup\$ Did you try to clean and rebuild or did you just do an incremental build? \$\endgroup\$
    – Roy T.
    Sep 4 '12 at 10:12
  • \$\begingroup\$ @RoyT. Yep, also posted on the nuclex forums: nuclexframework.codeplex.com/discussions/394286 But I guess this is one of those errors that you fix without knowing what you did and never get again. (I hate those) \$\endgroup\$ Sep 4 '12 at 11:28
  • 2
    \$\begingroup\$ This appears to require a close because the issue was unrelated to the framework and instead user error as indicated by the comments link. Voting to close. \$\endgroup\$ Apr 12 '14 at 4:05
2
\$\begingroup\$

I had exactly same error as you. It was fixed when I cleaned solution and build it again as @Roy T. suggested.

I think that for some reason Content doesn't rebuild correctly without a clean first.

\$\endgroup\$

You must log in to answer this question.

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