I like to answer the question in a more general way, so that it is useful to a wider group of people.
There are the following macros which allow to store the width, height (the material above the baseline) and depth (the material below the baseline) of a given content.
calc package also provides one for the total height (height + depth):
as well as
which can be used directly inside
If you need multiple dimension of the same content you can also store it in a box register and use its dimension directly (the above macros do this as well internally). These are dimension expressions and can be prefixed with a factor, e.g.
.5\wd\mybox is half the width.
\wd\mybox % width
\ht\mybox % height
\dp\mybox % depth
For the totalheight you need to add