How to get text width in pixels?

Hello.

Is  there any function in lua or Corona to get string width in pixels? I mean not  string length.

For example: two strings with equal length: “123456789” and “iiiiiiiii” (9 symbols). But width of first will be more than width of second. You can see it in first screenshot.

And if i use multiline display.newText() and set width to 40px(for example) - then first string will use 2 lines but second will use only one(second screenshot). So how can i get vertical offset or string width? 

Hope, you will understand what i mean :slight_smile:

https://docs.coronalabs.com/daily/api/type/DisplayObject/contentWidth.html

https://docs.coronalabs.com/daily/api/type/DisplayObject/contentHeight.html

@roaminggamer, Thank you a lot!

This is exactly what i want  :slight_smile:

https://docs.coronalabs.com/daily/api/type/DisplayObject/contentWidth.html

https://docs.coronalabs.com/daily/api/type/DisplayObject/contentHeight.html

@roaminggamer, Thank you a lot!

This is exactly what i want  :slight_smile: