Hello Guest

Author Topic: Default Characters in textmesh  (Read 3009 times)

gonzalez.martin90

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Default Characters in textmesh
« 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!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Default Characters in textmesh
« Reply #1 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.

gonzalez.martin90

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Default Characters in textmesh
« Reply #2 on: March 28, 2014, 07:32:46 pm »
Amazing, thanks!