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 合併指標
 (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

貢獻者指南