MonoGame/MonoGame

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

Open

#8,812 建立於 2025年6月3日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)C# (3,071 fork)batch import
FontHelp Wantedbughelp wantedregressionscope: content-pipelinescope: spritefont

倉庫指標

Star
 (13,886 star)
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

貢獻者指南