The Motionboutique, creators of the After Effects Physics Engine Newton, posts a little handy expression for getting the bounding box of a text layer in After Effects which, in the end, can be used to dynamically link properties easily to the size of the text object.

This After Effects expression allows you to determine the bounding box of a text layer

Using the sampleImage Expression, The Motionboutique is sharing the After Effects Expression and as an aside, the Motionboutique notes that if your text doesn’t really change, then you are able to save on rendering time by evaluating the expression at t=0 only -In any cases it is recommended to Convert Expression to Keyframes when you’re done with the text layer. Check out the Text Bounds Expression for After Effects here.