IGraphicText supports the IMGraphic functions for graphic transformations, including scaling, rotating, and translating.
To apply a transformation to an existing IGraphicText object:
For example, this code shows how to rotate
and center a text graphic in the IGrafPort port:
// create the ITextGraphic
IText string("Hello World!");
string.addStyles(ITextTypeFaceStyle("Helvetica"));
ITextGraphic graphic(string, ITextGraphic::kSingleLine);
// apply the transformation
graphic.rotateBy(45);
// center the bounding rectangle within the bounding rectangle
of the port
IGRect2D portBounds = port.worldBounds();
IGRect2D graph,icBounds = graphic.looseFitBounds(&port);
graph,ic.translateBy(portBounds.center() - graphicBounds.center());
// draw the graphic
graphic.draw(port);