Rendering text is an expensive operation. We have to take your string, pass various font information to the system’s API (which is different for each OS) and create a texture and a mask and return that rectangle back to OpenGL as a graphic texture.
When you change .text it should force the whole rendering process to fire. Replacing the text with the same text likely has a safety to prevent the text from re-rendering, which is why I suggested what I did above.
Still, the problem is the width. Since your working with an image in OpenGL changing .width probably just changes the texture width and doesn’t trigger a re-rendering. The width you pass in is a parameter and it doesn’t actually represent the width of the object, just the value we tell the OS text renderer to return.
That’s why I was hoping changing the text would force a re-render.
For us to address this we need a small demo project that we can run and see the problem. This includes a main.lua, config.lua, build.settings any font’s you’re using that’s not standard, and any other assets what we can unzip, point the simulator to it and see the problem (or build for device and see the problem.
Compress this project into a .zip file (please try and avoid other compressions, like RAR) and fill out a bug report here:
https://portal.coronalabs.com/bug-submission
Thanks
Rob