Respecting the bidirectional attributes

There are several ways to perform layout transformation. Bidirectional attributes, also known as layout attributes, describe how the bidirectional text is to be transformed. There are bidi layout transformation engines or bidi engines (such as ICU for C++, C, and Java) that receive a text string that follows a certain set of bidi attributes as input and transform it to a semantically equivalent string that follows a different set of bidi attributes.

Bidirectional attributes include the following:

Global orientation, which is also referred to as writing order, reading order, or paragraph direction determines the side of the screen, window, or page where the writing or rendering of the text has started. This indicates whether one should start reading or parsing the text from right to left or from left to right. Sometimes it is not clear whether the text begins from right to left or from the left to right.

Example: Consider the following string in physical sequence, in which lowercase characters represent Hebrew or Arabic characters and uppercase characters represent English characters:

DAVID DOES NOT BELIEVE taht yas syawla i

When reading from left to right, the meaning of the string becomes the following:

David does not believe I always say that

When reading from right to left, the meaning of the string changes to:

I always say that David does not believe

Indicates the type of algorithm to use to present the text. The ordering can be:

- Visual, where the entire text or screen is copied as is. This type is dependent on the programmer knowing where the embedded segments are located and processing them accordingly. Many IBM mainframe (Z/OS) and iSeries (i5/OS) applications and their files use this type of text.

- Implicit (also known as Logical), which recognizes directional segments based on the natural directionality of the characters. This scheme assumes that the letters of the Latin alphabet have inherent LTR directionality, and that Arabic, Persian, Urdu, Hebrew, and Yiddish letters have inherent RTL directionality. To accommodate bidirectionality, an algorithm of implicit text processing is used to recognize segments based on their inherent directional characteristics, allowing segment inversion to be performed automatically. MS Windows using code page win-1255 for Hebrew or win-1256 for Arabic, store data in implicit format.

Example: In the string below, lowercase characters represent Hebrew or Arabic characters and uppercase characters represent English characters:

ENGLISH TEXT txet cibara ro werbeh

- Explicit, which recognizes explicit directional controls embedded in the text. This scheme assumes that there are additional control characters embedded in a text string that directs the explicit algorithm to perform segment inversions, shaping or numeral selections, and other transformations.

Thus, text with a visual ordering scheme is stored in its physical order and a text with an implicit scheme is stored in its logical order, which is better suited for automatic processing. Text with an explicit scheme is usually stored in logical order, but because of the embedded controls in the text, the automatic processing is not always straightforward. The Basic Display Algorithm, that is defined in the Unicode Standard Bidirectional Algorithm combines the advantages of implicit and explicit ordering schemes.

Numbers embedded in an Arabic script can assume either Arabic or Hindi shapes. See Guideline A4 - Finding User Interface elements and Guidelines I , on the 'The Cursive Arabic Script' for more information.

Characters such as ( ) <> [ ] { and } have an implied directional meaning. Note that the list of all symmetric swapping characters is available on the Unicode Web site at (TXT, 23.4KB) . When transforming an Arabic or Hebrew text segment from implicit to visual ordering such as for presentation, these characters may need to be replaced by their corresponding symmetric sibling in order to preserve the meaning of the text. This attribute specifies whether symmetric swapping needs to be performed or not during the transformation.

Example: To preserve the same semantic meaning, the < character in the following right-to-left presented string, in which lowercase characters represent Arabic or Hebrew characters:

zyx < cba

is converted to > when the string is stored in logical (left-to-right) order as follows:

abc > xyz

Indicates the general layout of the elements of a window. In a right-to-left window, elements of the window progress in general from right to left and top to bottom.

Example: The vertical scroll bar, if present, is on the left side, and in general the geometry is the mirror image of an equivalent left-to-right window.

A radio button with right-to-left window orientation has its icon on the right and its text right-aligned on the left side of the icon. This text could itself have a left-to-right (for English) or a right-to-left (for Arabic/Hebrew) orientation.

Guideline H2

Respect the values of the bidirectional attributes when processing, exchanging, and presenting text.

Different multicultural environments may support bidirectional attributes to different extents. For example, IBM AIX and the IBM SDK Version 1.4.1 support a full range of values for the bidirectional attributes.

Your product must recognize and act upon the bidirectional attributes, and be able to query and set them. This guideline is relevant when processing, exchanging, and presenting bidirectional text in these environments. In many situations, compliance to the guideline is automatically achieved when your product uses the services offered by the underlying software or the platform itself. Note that not all of the bidirectional attributes are supported equally on all platforms.