character spacing

I have a number with 5 leading zeros that I’m trying to align to a background, for that that to happen, the digits needs to be further apart. I’m guessing there must be a string format to accomplish this?

CurrentTopHeight.text = string.format("%05d",math.round( HighestY ))

Guess not.

Hi @eriklen,

For this, you’d need to create the digits as separate text objects. It’s not ideal, but I wrote up a function which helps automate this somewhat. It may be useful for you (or maybe not), but it’s posted in the link below:

http://forums.coronalabs.com/topic/43536-letter-spacing-is-it-possible/

Best regards,

Brent

Hi Brent,

thanks for clearing that up for me and for providing the function. I’m afraid that splitting the number into separate digits is not an option in my code though. I already went down that route and it’s just not worth it.  I’ll alter the background to match the fonts instead.

Eriklen,

Are you sure it’s not an option? Is it because that number is constantly changing?

If so, you could have a function which fires every frame and takes the value of a variable, and either updates the individual text objects or  deletes them and creates new ones.

Nick

hi Nick,

I’m sure it’s doable, but I’m not going to implement it because it’s not important enough to commit resources to it, and I’m trying to keep the code as simple as possible. Therefore, altering the background is the simpler option.

Guess not.

Hi @eriklen,

For this, you’d need to create the digits as separate text objects. It’s not ideal, but I wrote up a function which helps automate this somewhat. It may be useful for you (or maybe not), but it’s posted in the link below:

http://forums.coronalabs.com/topic/43536-letter-spacing-is-it-possible/

Best regards,

Brent

Hi Brent,

thanks for clearing that up for me and for providing the function. I’m afraid that splitting the number into separate digits is not an option in my code though. I already went down that route and it’s just not worth it.  I’ll alter the background to match the fonts instead.

Eriklen,

Are you sure it’s not an option? Is it because that number is constantly changing?

If so, you could have a function which fires every frame and takes the value of a variable, and either updates the individual text objects or  deletes them and creates new ones.

Nick

hi Nick,

I’m sure it’s doable, but I’m not going to implement it because it’s not important enough to commit resources to it, and I’m trying to keep the code as simple as possible. Therefore, altering the background is the simpler option.