MonoGame/MonoGame

Regression: SpriteFont is able to read BitMap fonts but is unable to use MeasureString

开放

#8,812 创建于 2025年6月3日

 (2 条评论) (0 个反应) (0 位负责人)C# (3,071 个派生)batch import
FontHelp Wantedbughelp wantedregressionscope: content-pipelinescope: spritefont

仓库指标

星标
 (13,886 个星标)
PR 合并指标
 (平均合并 25天 3小时) (30 天内合并 22 个 PR)

描述

Prerequisites

  • I have verified this issue is present in the develop branch
  • I have searched open and closed issues to ensure it has not already been reported.

MonoGame Version

MonoGame 3.8.4

Which MonoGame platform are you using?

MonoGame Cross-Platform Desktop Application (mgdesktopgl)

Operating System

Windows

Description

XNA was able to Import Bitmaps as SpriteFonts, which MonoGame is still able to do.

However, the "SpriteFont.MeasureString" method was still able to determine the width of a SpriteFont from a defined string, MonoGame currently throws the following exception:

'Text contains characters that cannot be resolved by this SpriteFont. (Parameter 'text')'

Likely an issue with the "Font Texture - MonoGame" processor

Steps to Reproduce

Load a BitMap font texture as a SpriteFont Use the SpriteFont.MeasureString method

Minimal Example Repo

No response

Expected Behavior

Measure String should function the same as it did for XNA

Resulting Behavior

The MeasureString method cannot be used on BitMap SpriteFonts

Files

No response

贡献者指南