Rotate text about centre of bounding box


I want to rotated text about the centre of its bounding box, rather than the bottom left corner of the bounding box. I could not find any built-in method for this and I have run into problems implementing one myself. Before I spend any more time on this, has anyone already implemented such a method?


Simply define the text alignment as centred for both horizontal and vertical:

Thanks Olivier!