Can you pm me the code? Just the class and its usage. Thanks!
I'll just post it right here.
Code:
string FilterText(string str)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.Length; ++i)
sb.Append((str[i] >= 32 && str[i] <= 126) ? str[i] : '?');
return sb.ToString();
}
Change the range of characters it checks for if you are using CharacterRegions other than the default. You need to run that function on any text that might contain accented characters (that namely includes names of stuff from the user's music library) before passing it to DrawString.
string FilterText(string str)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.Length; ++i)
sb.Append((str[i] >= 32 && str[i] <= 126) ? str[i] : '?');
return sb.ToString();
}
Change the range of characters it checks for if you are using CharacterRegions other than the default. You need to run that function on any text that might contain accented characters (that namely includes names of stuff from the user's music library) before passing it to DrawString.
Why not just use this?
Code:
SpriteFont.DefaultCharacter = '?';
__________________
"Against logic there is no armor like ignorance." - Laurence J. Peter
Wow...they actually honored my bug report? :p I guess it was probably on the table anyway.
That's a pretty awesome feature; everybody needs to start using this. It appears that you can use it in the spritefont XML too; just add <DefaultCharacter>?</DefaultCharacter> along with all the other directives.
Wow...they actually honored my bug report? :p I guess it was probably on the table anyway.
That's a pretty awesome feature; everybody needs to start using this. It appears that you can use it in the spritefont XML too; just add <DefaultCharacter>?</DefaultCharacter> along with all the other directives.
I actually knew something that you did not know... but now you know it. Oh well.
I saw it in the documentation of things that they added, and I thought you would be pleased.
__________________
"Against logic there is no armor like ignorance." - Laurence J. Peter
WOW! nice. I am overall very pleased by the xna crew, they seem to listen to feedback.
Is this default when a spritefont is created, it should be!
I will add this tonight
Awesome! I'll be sure to try it out.
I verified that it isn't set by default (in fact, I don't think the <DefaultCharacter> XML setting is documented anywhere, though that's probably mainly due to the fact that the documentation for XNA 3.0 is weak overall).
I verified that it isn't set by default (in fact, I don't think the <DefaultCharacter> XML setting is documented anywhere, though that's probably mainly due to the fact that the documentation for XNA 3.0 is weak overall).
Great! Let me know how it works for you.
I wasn't quite sure where to put DefaultCharacter. Heres where i put it
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<DefaultCharacter>?</DefaultCharacter>
</Asset>
</XnaContent>
Its the last of the Asset declarations before the character region. When i had it before the sytle element, it said compile error, so i put it after.
Let me know how it works!
__________________
~Shutout5591~ [FINAL] Asteroids 1.0
If you like me work or I have helped you, + Rep me!
I wasn't quite sure where to put DefaultCharacter. Heres where i put it
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<DefaultCharacter>?</DefaultCharacter>
</Asset>
</XnaContent>
Its the last of the Asset declarations before the character region. When i had it before the sytle element, it said compile error, so i put it after.
Let me know how it works!
I assume you snipped the rest of the lines from the XML file.
That worked for SIR TET (which BTW I'm going to update to version 4ter later today).
When I went to the download page thingg, it just gave me like the code or something because it was a looong page of words that looked like the Visual C# code-a-mijigorr. If you could, or some else, upload it on a differnet server, I'd really appreciate it. :]] I've been waiting to play this gamee!