Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Dan Peach on October 15, 2012, 03:29:06 PM

Title: Stopping button text going onto new line
Post by: Dan Peach on October 15, 2012, 03:29:06 PM
Hello,

I have a button which acts as a text input field for my onscreen keyboard (for iOS). I need to limit the number of characters that can be entered so that the text doesn't go onto a new line, but I can't just set the length of the string because that doesn't work because some letters are wider than others. For example, in my text field, I can fit in 16 "m" characters, but if I set the length to not be greater than 16, then I can't fit in the words I need to fit in because they're more than 16 characters, even though they only fill up two thirds of the button.

So is there any way to just stop the button text from going onto a new line - obviously if it does that, it goes outside the background text field image. I just want the text to fill the button, right up to the point before it would go onto a new line, and then just not accept anymore characters. Can this be done?

Thanks. :)
Title: Re: Stopping button text going onto new line
Post by: Spellbreaker on October 17, 2012, 04:46:39 PM
Simply use a fixed width Font for the texts ( like bitmap fonts or something like Courier. There are several fixed-width truetype fonts available ).
Title: Re: Stopping button text going onto new line
Post by: Dan Peach on October 18, 2012, 10:25:15 AM
Thanks - that will solve the problem.  :)