Sunday, November 11, 2018

xna 4.0 - SpriteFont Exception, no such character?



I have such spriteFont:









Segoe UI



20


0


true

















Ұ





It has the character regions (32-1200)


And I get this exception:


A first chance exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.Graphics.ni.dll


The character 'с' (0x0441) is not available in this SpriteFont. If applicable, adjust the font's start and end CharacterRegions to include this character.



Parameter name: character


Why?


I'm drawing the string like this:


spriteBatch.DrawString(font24, zasadyText, zasadyTextPos, kolorCzcionki1, -0.05f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f)

I even changed the spriteFont to cyrillic:


    







ſ


А
ї






and it still doesn't work. I got the (0x441 => char) exception


-- EDIT --


Ok, I got the solution. It was a letter mistake in language. I had this:


if (jezyk == "ru_RU")
{
font14 = Content.Load("ru_font14");
font24 = Content.Load("ru_font24");

font12 = Content.Load("ru_czcionkaFloty");
font10 = Content.Load("ru_font10");

font28 = Content.Load("ru_font28");
font20 = Content.Load("ru_font20");
}

else
{
font14 = Content.Load("font14");

font24 = Content.Load("font24");
font12 = Content.Load("czcionkaFloty");
font10 = Content.Load("font10");

font28 = Content.Load("font28");
font20 = Content.Load("font20");
}

and there should be not "ru_RU" but "ru-RU"





I have no idea. I changed the spriteFont to cyrillic:


    






ſ



А
ї





and it still doesn't work. I got the (0x441 => char) exception




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...