8.4. Rotating text
Prev | Chapter 8. Text and font handling | Next

## 8.4. Rotating text

Both bit map and TTF fonts supports rotating text to different extent. With bit map fonts it is only possible to use horizontal or vertical text, i.e. 0 or 90 degree rotation. TTF fonts supports arbitrary angles. If you are using a bit map font and specifies an angle other than 0 or 90 then an error will be displayed.

The most common usage for rotating text is probably to adjust the labels on the x-axis so they are at 45 degrees angle. To rotate the label of an axis the method `Axis::SetLabelAngle()` should be used. Figure 8.3 shows an example of this (click on the filename to view the actual code).

Figure 8.3. Example of how to use rotated labels `(`bargradex1.php`)`

In addition to axis label it is also possible to rotate almost every other text object with the exception of graph titles which is always horizontal. For text objects (the class `Text`) that can be added to arbitrary positions on the graph the method `Text::SetAngle()` can be used to specify the wanted text angle. Another common place where text labels are rotated is when individual data points are marked with labels. This could be done for most plot types and in Figure 8.4 we show an example of using this for adding labels to a basic bar plot (click on the filename to view source).

Figure 8.4. Example of using rotated data point values `(`example20.3.php`)`

### Caution

When rotating text paragraph the alignment (within the paragraph) will always be reset to "left". It is not possible to use "center" or "right" paragraph alignment in rotated texts.

Prev | Up | Next
8.3. Understanding text alignment and anchor point | Home | 8.5. Formatting text paragraphs