SpriteFont 不适用于 MonoGame

SpriteFont not working with MonoGame

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

无论出于何种原因,无论发生什么,或者我做了什么更改,我总是会收到此错误。

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

我将内容文件夹中的 TopBarFont.spritefont 设置为内容,并始终像我所有其他资产一样复制到输出目录。

我的 spritefont 文件是这样的,

<?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>

我看到其他一些帖子只使用 2d 纹理并绘制它,但是没有..这默认了使用 DrawString 的全部目的。

使用this转换器将.SpriteFont转换成.xnb