Bidi.ReorderingMode Property

Definition

What is the requested reordering mode for a given Bidi object? -or- Modify the operation of the Bidi algorithm such that it implements some variant to the basic Bidi algorithm or approximates an "inverse Bidi" algorithm, depending on different values of the "reordering mode".

public virtual Android.Icu.Text.BidiOptions ReorderingMode { [Android.Runtime.Register("getReorderingMode", "()I", "GetGetReorderingModeHandler", ApiSince=29)] get; [Android.Runtime.Register("setReorderingMode", "(I)V", "GetSetReorderingMode_IHandler", ApiSince=29)] set; }
[<get: Android.Runtime.Register("getReorderingMode", "()I", "GetGetReorderingModeHandler", ApiSince=29)>]
[<set: Android.Runtime.Register("setReorderingMode", "(I)V", "GetSetReorderingMode_IHandler", ApiSince=29)>]
member this.ReorderingMode : Android.Icu.Text.BidiOptions with get, set

Property Value

the current reordering mode of the Bidi object

Attributes

Remarks

Property getter documentation:

What is the requested reordering mode for a given Bidi object?

Java documentation for android.icu.text.Bidi.getReorderingMode().

Property setter documentation:

Modify the operation of the Bidi algorithm such that it implements some variant to the basic Bidi algorithm or approximates an "inverse Bidi" algorithm, depending on different values of the "reordering mode". This method must be called before setPara(), and stays in effect until called again with a different argument.

The normal operation of the Bidi algorithm as described in the Unicode Standard Annex #9 is to take text stored in logical (keyboard, typing) order and to determine how to reorder it for visual rendering.

With the reordering mode set to a value other than REORDER_DEFAULT, this method changes the behavior of some of the subsequent methods in a way such that they implement an inverse Bidi algorithm or some other algorithm variants.

Some legacy systems store text in visual order, and for operations with standard, Unicode-based algorithms, the text needs to be transformed into logical order. This is effectively the inverse algorithm of the described Bidi algorithm. Note that there is no standard algorithm for this "inverse Bidi", so a number of variants are implemented here.

In other cases, it may be desirable to emulate some variant of the Logical to Visual algorithm (e.g. one used in MS Windows), or perform a Logical to Logical transformation.

<ul> <li>When the Reordering Mode is set to REORDER_DEFAULT, the standard Bidi Logical to Visual algorithm is applied.</li>

<li>When the reordering mode is set to REORDER_NUMBERS_SPECIAL, the algorithm used to perform Bidi transformations when calling setPara should approximate the algorithm used in Microsoft Windows XP rather than strictly conform to the Unicode Bidi algorithm. <br> The differences between the basic algorithm and the algorithm addressed by this option are as follows: <ul> <li>Within text at an even embedding level, the sequence "123AB" (where AB represent R or AL letters) is transformed to "123BA" by the Unicode algorithm and to "BA123" by the Windows algorithm.</li>

<li>Arabic-Indic numbers (AN) are handled by the Windows algorithm just like regular numbers (EN).</li> </ul></li>

<li>When the reordering mode is set to REORDER_GROUP_NUMBERS_WITH_R, numbers located between LTR text and RTL text are associated with the RTL text. For instance, an LTR paragraph with content "abc 123 DEF" (where upper case letters represent RTL characters) will be transformed to "abc FED 123" (and not "abc 123 FED"), "DEF 123 abc" will be transformed to "123 FED abc" and "123 FED abc" will be transformed to "DEF 123 abc". This makes the algorithm reversible and makes it useful when round trip (from visual to logical and back to visual) must be achieved without adding LRM characters. However, this is a variation from the standard Unicode Bidi algorithm.<br> The source text should not contain Bidi control characters other than LRM or RLM.</li>

<li>When the reordering mode is set to REORDER_RUNS_ONLY, a "Logical to Logical" transformation must be performed: <ul> <li>If the default text level of the source text (argument paraLevel in setPara) is even, the source text will be handled as LTR logical text and will be transformed to the RTL logical text which has the same LTR visual display.</li> <li>If the default level of the source text is odd, the source text will be handled as RTL logical text and will be transformed to the LTR logical text which has the same LTR visual display.</li> </ul> This mode may be needed when logical text which is basically Arabic or Hebrew, with possible included numbers or phrases in English, has to be displayed as if it had an even embedding level (this can happen if the displaying application treats all text as if it was basically LTR). <br> This mode may also be needed in the reverse case, when logical text which is basically English, with possible included phrases in Arabic or Hebrew, has to be displayed as if it had an odd embedding level. <br> Both cases could be handled by adding LRE or RLE at the head of the text, if the display subsystem supports these formatting controls. If it does not, the problem may be handled by transforming the source text in this mode before displaying it, so that it will be displayed properly. <br> The source text should not contain Bidi control characters other than LRM or RLM.</li>

<li>When the reordering mode is set to REORDER_INVERSE_NUMBERS_AS_L, an "inverse Bidi" algorithm is applied. Runs of text with numeric characters will be treated like LTR letters and may need to be surrounded with LRM characters when they are written in reordered sequence (the option INSERT_LRM_FOR_NUMERIC can be used with method writeReordered to this end. This mode is equivalent to calling setInverse() with argument isInverse set to true.</li>

<li>When the reordering mode is set to REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual Bidi algorithm is used as an approximation of an "inverse Bidi" algorithm. This mode is similar to mode REORDER_INVERSE_NUMBERS_AS_L but is closer to the regular Bidi algorithm. <br> For example, an LTR paragraph with the content "FED 123 456 CBA" (where upper case represents RTL characters) will be transformed to "ABC 456 123 DEF", as opposed to "DEF 123 456 ABC" with mode REORDER_INVERSE_NUMBERS_AS_L.<br> When used in conjunction with option OPTION_INSERT_MARKS, this mode generally adds Bidi marks to the output significantly more sparingly than mode REORDER_INVERSE_NUMBERS_AS_L.<br> with option INSERT_LRM_FOR_NUMERIC in calls to writeReordered.</li>

<li>When the reordering mode is set to REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the Logical to Visual Bidi algorithm used in Windows XP is used as an approximation of an "inverse Bidi" algorithm. <br> For example, an LTR paragraph with the content "abc FED123" (where upper case represents RTL characters) will be transformed to "abc 123DEF.</li> </ul>

In all the reordering modes specifying an "inverse Bidi" algorithm (i.e. those with a name starting with REORDER_INVERSE), output runs should be retrieved using getVisualRun(), and the output text with writeReordered(). The caller should keep in mind that in "inverse Bidi" modes the input is actually visually ordered text and reordered output returned by getVisualRun() or writeReordered() are actually runs or character string of logically ordered output.<br> For all the "inverse Bidi" modes, the source text should not contain Bidi control characters other than LRM or RLM.

Note that option OUTPUT_REVERSE of writeReordered has no useful meaning and should not be used in conjunction with any value of the reordering mode specifying "inverse Bidi" or with value REORDER_RUNS_ONLY.

Java documentation for android.icu.text.Bidi.setReorderingMode(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to