Is there an easy way to make default XNA method SpriteBatch.DrawString
substitute characters that are not in spritefont with ?
sign? I could go with an extension method, but I'm not sure how to implement it, as there is no way to know if a character is not in the spritefont beforehand.
Substitute missing characters with "?" character
213 views Asked by user1306322 At
1
This functionality is built-in. Open the
.spritefont
file for your font and scroll down to here:Uncomment that line and replace the character with the one you want, like so:
You can also achieve the same effect by modifying the
SpriteFont.DefaultCharacter
property at runtime.If you need it, you can get a list of the available characters in a font through the
SpriteFont.Characters
property.