Document directionality

In TopLeaf the whole document has a directionality that controls the placement of fixed blocks and the way the book is bound. The document directionality is responsible for the selection of left and right page layouts, and in a multi-column page layout the order in which the data block columns are filled.

The document directionality is determined from the language associated with the document root element. The default document language can be declared as a publication formatting option or overridden by the language set by the xml:lang attribute or through the <text-properties lang="LA" /> directive.

A single stylesheet can be used for both RTL and LTR documents. The TopLeaf convention is that all right and left terms switch direction when RTL mode is in force.

In RTL mode layouts are dynamically modified as follows:

  • If the layout has separate left and right page definitions the sense of left and right pages is reversed, so odd-numbered pages use the left page definition, and even-numbered pages use the right.

  • The blocks within the data area are reflected by adjusting their left and right margins.

The following diagram show how this works for a simple layout:

The first step swaps the layout pages so that the fixed footer block only appears on odd-numbered pages. The data blocks are then reflected so the sidenotes maintain their position relative to the start of the paragraphs in the data block.

[Note] Note

This process will not produce the expected result for data blocks positioned using Inside and Outside. If your layout uses these you may need to use a separate layout for RTL documents.

In RTL mode paragraph alignment is adjusted by reversing Left and Right. Other alignments are not affected.