Display text vertically using XDrawString

I am using XDrawString to display text on a drawing area. By default this seems to display text horizontally from Left to Right.

Could any one please tell me how I can use this library function to rotate and display text vertically from Top to Bottom or from Bottom to top.

Thanks in advance for you help.


You need to call it once per character, there's no single function that can draw a rotated string in Xlib. Here's a quote from the Programming Manual:

Vertical Text and Rotated Text

Xlib provides routines that draw horizontal strings, but not vertical ones. If you want to draw strings vertically that read normally, you need to use a separate text drawing call for each character. You use a baseline with the same x coordinate but a different y coordinate for each character.

Need Your Help