Search code examples
c#xnaxna-4.0monogamespritefont

SpriteFont not working with MonoGame


font = Content.Load<SpriteFont>("TopBarFont");

For whatever reason no matter what happens, or what I change, I always get this error.

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

I have TopBarFont.spritefont in the content folder set as content and to always copy to the output directory like all my other assets.

My spritefont file looks like this,

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
    <Asset Type="Graphics:FontDescription">
        <FontName>Open Sans Light</FontName>
        <Size>36</Size>
        <Spacing>0</Spacing>
        <UseKerning>true</UseKerning>
        <Style>Regular</Style>
        <CharacterRegions>
            <CharacterRegion>
                <Start>&#32;</Start>
                <End>&#126;</End>
            </CharacterRegion>
        </CharacterRegions>
    </Asset>
</XnaContent>

I saw some other posts to just use a 2d texture and draw that, but just no.. That defaults the whole purpose of using DrawString.


Solution

  • Use this converter to convert .SpriteFont into .xnb