2

I'm trying to draw text in a Monogame program. I want to use a SpriteFont to do it, but I get the following error when trying to load the SpriteFont.

//Here I try to load the SpriteFont
//It is kept in the "Content/fonts" folder, with "Content" as the Content.RootDirectory
Font = Content.Load<SpriteFont>("fonts/SpriteFont1");

//I then get this error
An unhandled exception of type 'System.NotImplementedException' occurred in MonoGame.Framework.dll
Additional information: The method or operation is not implemented.

The SpriteFont1 build action is set to "Content" with Copy To Output Directory as "Copy Always". The SpriteFont1.xnb file is in the Content folder, with the same settings. How can I fix the error so that I can load the SpriteFont?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Ben
  • 1,299
  • 3
  • 17
  • 37
  • A method is not implemented. This could be in the Mono library. The stack trace will show which method. – Richard Schneider Jan 26 '15 at 23:31
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Jan 27 '15 at 00:33

2 Answers2

5

Simple fix. Following the stack trace (thanks to Richard Schneider), I found that the SpriteFont1.xnb file needed to be in the same folder as the actual .SpriteFont file.

Ben
  • 1,299
  • 3
  • 17
  • 37
0

Actually, only .xnb file is needed as it is compiled from the .SpriteFont, so you should copy only the .xnb file to the Content folder.

The NotImplementedException is because the LoadContent is not implemented to load .SpriteFont file directly. (Tested in MonoGame 3.5)

Tr1et
  • 873
  • 11
  • 25