Hmm is this even posible? well if it is then I dont know how o do it, but mabie someone will help??
Well you get the Idea because of the title ( mabie ) but I will try my best to explain!
For example i have 16x8 rectangle and I draw a text inside it, when I hit the borders of the rectangle one of the texts chars will disapear.
How to draw text/string inside a retangle?
Started by LeDark Lua, Jun 14 2015 04:51 PM
2 replies to this topic
#1
Posted 14 June 2015 - 04:51 PM
#2
Posted 14 June 2015 - 05:05 PM
Could you show us the code?
And maybe you can try drawing the rectangle and then the text?
And maybe you can try drawing the rectangle and then the text?
Edited by The_Cat, 14 June 2015 - 05:06 PM.
#3
Posted 14 June 2015 - 05:28 PM
That for the most part is just maths - if you have a rectangle that is 16 pixels in width, your text obviously should be shortened after a length of 16.
If you take a look on this, you'll see some methods for string manipulation.
Example:
This would result in the string being shortened to a maximum length of 16 characters - if the text is shorter than that, it'll just stay the same length.
If you take a look on this, you'll see some methods for string manipulation.
Example:
local yourString = "Hello" local boxWidth = 16 yourString = yourString:sub( 1, boxWidth ) --# Same as string.sub( yourString, 1, boxWidth )
This would result in the string being shortened to a maximum length of 16 characters - if the text is shorter than that, it'll just stay the same length.
Edited by wieselkatze, 14 June 2015 - 05:30 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











