spritefont causing problems

Jun 25, 2012 at 7:59 PM
Edited Jun 25, 2012 at 8:01 PM

i followed spritefont instructions and tried to get a "hello world" working. I used the conv tool to create a arial.spritefont and try to initialize like below

 

 

 

spriteFont = std::unique_ptr<DirectX::SpriteFont>(new DirectX::SpriteFont(m_d3dDevice.Get(), L"Assets//arial.spritefont" )); 

 

 

 

Its causing exception...invalid arguments.

can you please quickly test it out (I used the makespritefont as below)

"MakeSpriteFont.exe "Arial" arial.spritefont /FontSize:16"

 

 

 

 

 

 

Coordinator
Jun 26, 2012 at 3:54 AM

Where does this exception come from?  You need to look in the debugger to see what the source of the exception is, which will tell you what has gone wrong.

My guess would be perhaps you aren't specifying the right path to the file you are trying to load?  But that's just a guess - the debugger will tell you for sure.

Jun 26, 2012 at 4:21 PM

I use the same path/filelocation for one of my sprite img files, it worked with spritebatch. spritefont is having problems..i think may not relate to filepath or location.

The debugger says the error is inside system, does say much about exception except that its invalid parameter error.

Coordinator
Jun 26, 2012 at 7:54 PM

Try enable 'break on exceptions' in the debugger to see where exactly the exception is originally thrown.

http://msdn.microsoft.com/en-us/library/d14azbfh(v=vs.110).aspx

Jul 4, 2012 at 2:20 PM
Edited Jul 4, 2012 at 2:22 PM

I bcome the same Error in this line with the Options for the Spritefont "Kootenay" myfile.spritefont /FontSize:30.

m_spriteFont=unique_ptr<SpriteFont>(new SpriteFont(m_d3dDevice.Get(),L"Assets\\myfile.spritefont"));
when i walk into the Code whith F11 to this Funktion
BinaryReader::BinaryReader(_In_z_ wchar_t const* fileName)
{
    size_t dataSize;

    ThrowIfFailed(
        ReadEntireFile(fileName, mOwnedData, &dataSize)
    );

    mPos = mOwnedData.get();
    mEnd = mOwnedData.get() + dataSize;
}
the Error was throw in the ReadEntireFile(fileName, mOwnedData, &dataSize)
at this code
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) ScopedHandle hFile(safe_handle(CreateFile2(fileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
Jul 4, 2012 at 2:42 PM

I had found the Error in my Projekt.

When you add the myfile.spritefont to the Projekt you have to check that the Content Property is true (because of I have the German Version I didn't know the exant English Name)