Get the calculated font-size for your text element:
parseInt(window.getComputedStyle(text[0]).fontSize, 10);
font-size represents the size of the em square for the font. It should be noted that although most glyphs will be inside em boundaries, some may exceed these boundaries. This usually does not occur in vertical dimensions.
Try: http://jsfiddle.net/uzgJX/1/ . Tip: take a screenshot and copy to your favorite image editor, then select the pixels exactly in the height of the text and compare with the value specified in the script.
Andy e
source share