2D Toolkit Forum

2D Toolkit => Support => Topic started by: gonzalez.martin90 on March 26, 2014, 12:43:48 pm

Title: Default Characters in textmesh
Post by: gonzalez.martin90 on March 26, 2014, 12:43:48 pm
Hi, i have a problem with some characters that i dont have in the spritesheet.
 I would like to replace the characters that dont exist in the sprite for "?". Is it possible?

Thanks!
Title: Re: Default Characters in textmesh
Post by: unikronsoftware on March 27, 2014, 10:35:34 am
Yes it is - in tk2dTextGeomGen.cs, look for these lines:
Code: [Select]
if (fontInst.useDictionary)
{
if (!fontInst.charDict.ContainsKey(idx)) idx = 0;
chr = fontInst.charDict[idx];
}
else
{
if (idx >= fontInst.chars.Length) idx = 0; // should be space
chr = fontInst.chars[idx];
}

idx = 0 is picked when the character isn't found, you can replace that with anything else there.
Title: Re: Default Characters in textmesh
Post by: gonzalez.martin90 on March 28, 2014, 07:32:46 pm
Amazing, thanks!