score:3

You get the bounding box of the text, check whether it's too big for the rect element and remove it if this is the case. Here is an example of how to get the bounding box of a text element.


Related Query