The <rotate-text/> command

The <rotate-text/> command renders a rotated text string.

The command format is:

<rotate-text 
angle="ANG" 
string="STR" 
width="MEASURE" 
align="HPOS" 
/>

where :

  • ANG specifies the angle by which the text is rotated (one of 90 (default, 180 or 270). Note that the text is rotated anti-clockwise so, for example, text rotated by 90 degrees flows from bottom to top.

  • STR is the text to be rotated. The rotated text string can only contain character data. The minimum interword space is used to calculate the width of all white space within the rotated string.

  • MEASURE specifies the maximum width of the rotated text for rotations of 90 or 270. If the width of the rotated text string exceeds this value then TopLeaf will break the text string into one or more separately rotated strings. The width is declared as a measure that must be greater than or equal to zero.

    The algorithm used to break up the text string fits a series of white space separated words into lines that do not exceed the specified width. The current font size is used when fitting content to each generated line. The algorithm does not apply any hyphenation or language specific line breaking rules.

  • HPOS specifies the alignment used when fitting text within a specified width. The alignment value is one of left, right, or center. The default alignment is left. This value is ignored if the maximum rotated text width is not defined.

Each rotated text string occupies a height equal to its unrotated width and a width equal to the current font size (including leading). If within a box or table cell, the rotated text will honor properties such as text indents and horizontal and vertical alignment. The rotation is based on the current baseline. When combining rotated and unrotated text on the same line, it may be necessary to apply a little whitespace before/after the rotated text to allow for underlines and descenders.

If you need to rotate multiple lines of text then rotate each line using separate <rotate-text/> commands.

[Warning] Warning

This command cannot be used inside fixed blocks such as headers and footers — these use their own rotation mechanism. It is however possible to use rotated text within footnotes and sidenotes.