Data streams

This section discusses data streams for the bidirectional text environment.

Bidirectional text environments use the following data streams:

Data stream Description
Visual Data Streams The system organizes characters in the sequence in which they are presented on the screen.

If a visual data stream is presented from left to right, the first character of the data stream is on the left side of the viewport (screen, window, line, field, and so on). If the same data stream is presented on a right-to-left viewport, the initial character of the data stream is on the right.

If a language of opposite writing orientation is embedded in the visual data stream, the sequence of each text is preserved when the viewport orientation is reversed. For example, (the lowercase text represents bidirectional text) if the keystroke order is :

THERE IS bidirectional text IN THIS SENTENCE.

then the visual data stream is:

THERE IS txet lanoitceridib IN THIS SENTENCE.

This visual data stream's presentation on a left-to-right viewport is left-justified, as follows:

THERE IS txet lanoitceridib IN THIS SENTENCE.
-------> <----------------- ---------------->

The arrows indicate reading direction.

If you change the viewport orientation to right-to-left, the visual data stream is reversed, right-justified, and unreadable, as follows:

.ECNETNES SIHT NI bidirectional text SI EREHT
<---------------- -----------------> <-------

Thus, if English text is embedded in Arabic or Hebrew text, both texts are in proper reading order only on a left-to-right viewport. The same is true for Arabic or Hebrew embedded in English. Reversing the viewport orientation makes both texts unreadable.

Logical Data Streams The system organizes characters in a readable sequence. The bidirectional presentation-management functions arrange text strings in a readable order.

If a logical data stream is presented on a left-to-right viewport, the initial character of the data stream is presented on the left side. If the same data stream is presented on a right-to-left viewport, the initial character of the data stream is presented on the right side, though it is still presented in a readable order.

If a language of opposite writing orientation is embedded in the logical data stream, the orientations of each text are preserved by the bidirectional presentation-management functions. For example, if the keystroke order is:

THERE IS bidirectional text IN THIS SENTENCE.

then the logical data stream is the same. For example:

THERE IS bidirectional text IN THIS SENTENCE.

This logical data stream's presentation on a left-to-right viewport (left-justified) is as follows:

THERE IS txet lanoitceridib IN THIS SENTENCE.
-------> <----------------- ---------------->

The logical data stream's presentation on a right-to-left viewport (right-justified) is as follows:

IN THIS SENTENCE. txet lanoitceridib THERE IS
----------------> <----------------- ------->

The logical data stream is readable on both viewport orientations.