How do I fit text?

Text should stay in the white rectangle.
If the text reaches the end size of the text should decrease.
If I delete letters size of the text should increase.


sorry I am bad at explanations

Maybe you can have a ghost object at the end of the text.
If the ghost object is out of the white, reduce text size.
If backspace is pressed, increase text size.

Maybe also you can use the font size * number of characters, not sure.
If whitebox_width < char_count*char_size
→ reduce char_size

Give it a try and let us know!