Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Adding a space after letter is rendering wrong width?

A topic by Noxlof created 63 days ago Views: 71 Replies: 5
Viewing posts 1 to 4

Yo!

So I'm making a virtual keyboard and noticed that whenever I add a " " (space) after a letter it doesn't render with the correct width?
If I do double (a space after a space) or a letter after the space the width is correct!

Don't know if this is the "correct" way to do it, but I just add " " to a local string and set that string to STM.text:

public void KeyboardSpace()
{
    inputText += " ";
    STM.text = inputText;
}

inputText being just a local string that I add strings to.

If I inspect the SuperTextMesh component the Layout Properties seems to give me the correct Preferred Width and Height when I add/remove a character and with single or double spacing! I'm also using finalBottomRightTextBounds for the caret x-position and that seems to follow the rendering spacing.

Might not be super clear but there is a small width change whenever I add a space!

Any way to solve this?
Thanks! :-)
/Lucas

Developer

Interesting, I've been messing with a few things related to characters being inserted automatically, so I will give this a look as soon as I can! (Kind of in the shader trenches here, but it looks like you're using this correctly, something is just messing up on my end...) My best guess so far just by looking at it is that it's trying to insert a zero-width space, but that wouldn't show anything at all, or maybe it's a hyphen/soft hyphen that doesn't exist in the font? Anything happen differently if "insertHyphens" is set to false?


Either way, I've got an update I'd like to publish this week and I've done so many changes I can't tell if this was fixed or not, so if you send me an email thru my website with your invoice no., I can get you the latest build of that to see if it has a difference? Otherwise, that will hopefully be published soon and we can recap then!

Gotcha!
I went ahead and tried it with different fonts and insertHyphens true/false for each but it resulted with the same results

I also took some screenshots to see how much the caret would move when the "smaller space" appeared, with the settings I got (Middle Anchor, Center Alignment, Size 64, Resolution: 1920x1080) it only moved 1 pixel to right (2 pixels with Left Alignment) so It is a very small size that seems to be added

It's not an urgent issue on my end just wanted to let you know :-)
 Looking forward to the update!

Developer

New update is out! So after the long weekend, I'll be able to give this a look if it's still happening!

Yo!
Sorry for the late reply, we just updated to the latest version and the spacing is still there!

Developer

Hey! I've actually got a new *new* update that I'm about to publish - hoping that one will solve this issue for good. (Now, the zero-width space is *always* zero-width, regardless of font) Should be up in a few hours!