Take a
Bidi
object containing the reordering information for a piece of text (one or more paragraphs) set by
setPara()
or for a line of text set by
setLine()
and return a string containing the reordered text.
The text may have been aliased (only a reference was stored without copying the contents), thus it must not have been modified since the setPara()
call.
This method preserves the integrity of characters with multiple code units and (optionally) combining characters. Characters in RTL runs can be replaced by mirror-image characters in the returned string. Note that "real" mirroring has to be done in a rendering engine by glyph selection and that for many "mirrored" characters there are no Unicode characters as mirror-image equivalents. There are also options to insert or remove Bidi control characters; see the descriptions of the return value and the
options
parameter, and of the option bit flags.
@param options A bit set of options for the reordering that controlhow the reordered text is written. The options include mirroring the characters on a code point basis and inserting LRM characters, which is used especially for transforming visually stored text to logically stored text (although this is still an imperfect implementation of an "inverse Bidi" algorithm because it uses the "forward Bidi" algorithm at its core). The available options are:
DO_MIRRORING
,
INSERT_LRM_FOR_NUMERIC
,
KEEP_BASE_COMBINING
,
OUTPUT_REVERSE
,
REMOVE_BIDI_CONTROLS
,
STREAMING
@return The reordered text.If the
INSERT_LRM_FOR_NUMERIC
option is set, then the length of the returned string could be as large as
getLength()+2*countRuns()
.
If the
REMOVE_BIDI_CONTROLS
option is set, then the length of the returned string may be less than
getLength()
.
If none of these options is set, then the length of the returned string will be exactly
getProcessedLength()
.
@throws IllegalStateException if this call is not preceded by a successfulcall to
setPara
or
setLine
@see #DO_MIRRORING
@see #INSERT_LRM_FOR_NUMERIC
@see #KEEP_BASE_COMBINING
@see #OUTPUT_REVERSE
@see #REMOVE_BIDI_CONTROLS
@see #OPTION_STREAMING
@see #getProcessedLength
@stable ICU 3.8