Adapts the overlay size to the text size