Structured Text Overview

Languages like Arabic and Hebrew are generally written from right to left, but included numbers and phrases in English must be written from left to right. This is the origin of the term "bidirectional" which qualifies these languages.

In most computer environments, the text is stored in logical order (the order the text is read) but is reordered into visual order for presentation. For plain text, the Unicode Bidirectional Algorithm (UBA) generally specifies satisfactorily how to reorder bidirectional text for display. This algorithm, or close to it, is implemented in the presentation systems of a number of platforms, giving them a good handle on bidirectional support.

However, all bidirectional text is not necessarily plain text. There are also instances of text structured to follow a given syntax, which should be reflected in the display order. The general algorithm, which has no awareness of these special cases, often gives incorrect results when displaying such structured text.

This document describes various examples of this issue, and proposes a methodology to solve the related problems. The types of structured text treated in this document are all excerpted from actual products, including Eclipse.

For a general introduction to bidirectional concepts, the reader is kindly referred to the following technical article: "Bidirectional script support: a primer" available at

Working with Structured Text

Eclipse provides support for correct presentation of structured text. The base functionality can be found in the package "org.eclipse.equinox.bidi". The methods process() and deprocess() and their variants in class STextProcessor will be a good starting point.

Consumers who would like to adjust Bidi environment settings, process bidi text in portions, or directly manage directional formatting will find lower level functionality available in the "org.eclipse.equinox.bidi.advanced" package.

Developers wishing to create handlers for types of structured text not currently supported by Eclipse "out of the box" will create extensions for class STextTypeHandler in package "org.eclipse.equinox.bidi.advanced". Such new type handlers should register with the "org.eclipse.equinox.bidi.bidiTypes" extension point.