Page 1 of 1
Font:WrapText
Posted: 02 Mar 2011, 05:09
by Von66341
Hi hi,
Anyone know how does Font:WrapText work?
I wrote this line:
FontWrapText("Please press Shift and type you current plan.",15,10,15)
but nothing was printed.
Thanks.
Re: Font:WrapText
Posted: 02 Mar 2011, 10:55
by jK
check your syntax
wiki wrote:font:WrapText
( string "text", number max_width [, number max_height [, number size ] ])
-> nil | string wrappedText, number lines
Re: Font:WrapText
Posted: 03 Mar 2011, 01:13
by Von66341
if you write it with the [] brackets it doesn't work at all.
I think they are use to explain how it works.
Any ideas? thanks.
Re: Font:WrapText
Posted: 03 Mar 2011, 01:32
by knorke
string wrappedText
appearently the function returns the new wrapped text. with newlines \n inserted or something
Re: Font:WrapText
Posted: 03 Mar 2011, 01:59
by Von66341
I tried this:
wrappedText, lineCount = myFont:WrapText("text to wrapped", 30, 30, 30 )
myFont:Print(wrappedText,x,y,fontsize,"O")
My results are:
text to ...
it doesn't seem to insert \n
Any ideas?
Re: Font:WrapText
Posted: 03 Mar 2011, 09:30
by jK
You set the function argument max_height to 30, which obviously is only enough for 1 line. Btw you don't need to set it at all, you can leave it out or set it to nil when you need to set the fontsize argument (when fontsize isn't defined it uses the native one defined when the font was created with gl.CreateFont).
Re: Font:WrapText
Posted: 03 Mar 2011, 11:01
by Von66341
Thanks lots!
I manage to get it to work =D