Previous posts in this series:

  1. Introduction
  2. Paragraph direction and flow
  3. Directionality codes
  4. Mirroring

As I mentioned in a previous post, it is possible to adjust the behavior of bidirectional text by including override characters in the text. Here are some situations where you might want to do this:

  • To indicate the embedded structure of the text. For instance, if you have a Spanish article that includes Hebrew sentences and those Hebrew sentences include English phrases, you need embedding codes to make the various levels clear. To achieve this you would use RLE/PDF around the Hebrew and LRE/PDF around the English.
    • Example: este artículo está escrito en español. <RLE>HERE IS A HEBREW SENTENCE WITH AN <LRE>english phrase<PDF> INSIDE. AND THIS IS ANOTHER HEBREW SENTENCE THAT CONTAINS <LRE>more english <PDF> WORDS. <PDF> volvemos ahora al español.

Display of three levels of embedded structure using RLE, LRE, and PDF. Lower-case indicates left-to-right text and upper-case indicates right-to-left.

  • To use the characters differently from the way they were intended. Some examples:
    • In a right-to-left script, digits are not serving as numbers per se, but as elements of an ID tag such as a serial number. In this case you might want to force the digits to behave more like letters with regard to the way they are written. The RLO override character would be placed before the digits to make them act like letters.
      • Example: AxT<RLO>139dm; in right-to-left text this would be displayed: md931TxA
    • A sequence of right-to-left letters within left-to-right text is being treated simply as a list of characters rather than as actual text. The LRO character before the right-to-left letters will make them act left-to-right.
      • Example: Some Arabic letters (<LRO>, , , and ) only connect cursively on the right side.
    • A chapter/verse range such as those used in Biblical verse references is using a colon as a numerical separator rather than punctuation.
      • Example: MATTHEW 6<RLM>:9-13; as right-to-left text this would be displayed:13-9:6 WEHTTAM. Without the RLM it would be displayed:13-6:9 WEHTTAM.

  • To force punctuation to behave as if it were associated with a certain range of text. For instance, final punctuation on an embedded sentence would take on the direction of the top-level paragraph; to make it use the direction of the embedded sentence instead, an override (RLO or RLM) or embedding character (RLE/PDF) could be used.