i would think its cause corona was built as a game engine and there’s not much need to change the font of text after its created. but now as developers are starting to use corona for more business apps i could see more need for it
Yes, and from a technical standpoint, they already have a property (.size) that can be changed, and that internally forces a redraw of the whole font bitmap, which is what a change to the typeface would also need to do.
create both text on the first place, then with some logic hide the second or the first using “object.alpha”
then if you press the button you can just change the alpha’s of the text to hide and reveal them
Jam
Changing the font size probably is just a scaling thing. The display.newText() is renedered as an OpenGL texture and as such once it’s rendered it’s the same as an image, rectangle, etc. So changing scale is easy, but to change the font means dropping the texture and re-creating it. (I’m speculating on this. I’ll need to ask engineering to make sure).
Well, here is what the “Wednesday FAQs” blog entry by Tom Newman on June 26 said:
- I’m moving text around on the screen, will that slow down my app?
Moving or scaling text objects does not slow down Corona SDK. If you are changing the text, the bit map needs to be recreated, which can impact the frame rate. The same is true when changing the font size or the font type. These all require a new bit map and may affect performance.
This answer was another reason I thought this was possible in the first place!