# Rotating Text

## Recommended Posts

Hello,

How can i obtain the font sprite's dimensions I use to render D3DX fonts?

d3dxFontSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);
d3dxFont->DrawText(d3dxFontSprite, str.c_str(), -1, &rct, 0, getD3DColor(color));
d3dxFontSprite->End();

My goal is to rotate the text about the sprite's center instead of the world origin.

Thanks.

##### Share on other sites
There is DT_CALCRECT flag, it'll fill your RECT structure with coordinates.

##### Share on other sites
How can I use the RECT structure after the draw call and text is already rendered?

What I want to do is to be able to rotate text around it's center instead of the origin (0, 0)

Thanks.

##### Share on other sites
You want:
RECT rct;rct.left = rct.top = rct.right = rct.bottom = 0;d3dxFont->DrawText(NULL, str.c_str(), -1, &rct, DT_CALCRECT, 0);

##### Share on other sites
Then it's too late to make use of the returned rc to figure out the correct transformation for the already drawn text ;)

##### Share on other sites
If you use DT_CALCRECT, the text isn't drawn, but the rectangle is updated.