This After Effects expression allows you to determine the bounding box of a text layer.
UPDATE: check out our “TextBox” script!
It can be used to dynamically link some properties (for instance the position of an other layer) to the text size.
See attached project (CS6).
Note :
If the text doesn’t change, you can save render time by evaluating the expression at t=0 only. It is recommended to Convert Expression to Keyframes when you’re done with the text layer.