In many design tools if I double click on a bounding box i.e. text element, then mentioned bounding box will shrink to the size of the content