I would like to put text inside a bubble, and I want that my bubble be equal to the text width, but if the text length is too long, I would like the text to wrap automatically a
You can also try something like this, using the dummy text box mentioned above:
width: Math.min(dummy_text.paintedWidth, 250)
This will use the painted size of the text unless it is greater than your specified pixel width.