17.3.2.8 dir

This element specifies that the embedding level of its contents shall be increased, as described by the Bidirectional Algorithm (cf. Unicode Technical Report #9). Unlike the rtl element (17.3.2.30), this element can be nested and causes the embedding level to increase appropriately. Within this element, the semantics for the rtl element shall continue apply, specifying a high-level override of the character classification applied at the appropriate embedding level. [Note: The presence of this markup is functionally equivalent to the presence of a LRE/RLE character at the location of the start element, and a corresponding PDF character at the location of the end element in a string of Unicode text. end note]

[Example: Consider a left-to-right paragraph that has a quote in a right-to-left language, but the quote itself includes left-to-right text. In this case, the text layout within the quote should be read from right-to-left. Adding this element around the quote increases the embedding level and result in the desired layout. (Assume the lower-case text is English and the upper-case text is Arabic or Hebrew):

<w:r>
  <w:t>he said: “</w:t>
</w:r>
<w:dir w:val=”rtl”>
  <w:r>
    <w:rPr>
      <w:rtl />
    </w:rPr>
    <w:t>I LEAVE FOR </w:t>
  </w:r>
  <w:r>
    <w:t>united states</w:t>
  </w:r>
  <w:r>
    <w:rPr>
      <w:rtl />
    </w:rPr>
    <w:t xml:space="preserve"> TOMORROW</w:t>
  </w:r>
</w:dir>
<w:r>
  <w:t>”.</w:t>
</w:r>

The alternating RTL and LTR elements help in resolving the classification of characters within this run as follows:

he said: “I LEAVE FOR united states TOMORROW”.
LLLLLLLLLLRRRRRRRRRRRRLLLLLLLLLLLLLRRRRRRRRRLL

But the fact that the quote is enclosed in an RTL embedding; the following embedding levels are generated:

he said: “I LEAVE FOR united states TOMORROW”.
0000000000111111111111222222222222211111111100

This generates the following text layout:

he said: “WORROMOT united states ROF EVAEL I”.

end example]

Attributes

val (Direction of Embedding)

Specifies the direction of the embedding being applied.

If this attribute is omitted, the embedding shall be assumed to be ltr.

[Example: For example, consider the following bidirectional embedding:

  <w:dir
        w:val="rtl">
  </w:dir>

The val attribute explicitly declares that the embedding is applied right to left. end example]

The possible values for this attribute are defined by the ST_Direction simple type (17.18.12).

[Note: The W3C XML Schema definition of this element’s content model (CT_DirContentRun) is located in A.1. end note]

Last updated on