Several comments show that the output of this function is often not what is expected, especially when the text is rotated.
For those of you who'd like a visual representation of what is happening to the bounding box as the text is rotated, take a look here:
http://ruquay.com/sandbox/imagettf/