java.lang.ObjectReference implementation of the Unicode 3.0 Bidi algorithm.com.lowagie.text.pdf.BidiOrder
This implementation is not optimized for performance. It is intended as a reference implementation that closely follows the specification of the Bidirectional Algorithm in The Unicode Standard version 3.0.
Input:
There are two levels of input to the algorithm, since clients may prefer
to supply some information from out-of-band sources rather than relying on
the default behavior.
Output:
Output is separated into several stages as well, to better enable clients
to evaluate various aspects of implementation conformance.
As the algorithm is defined to operate on a single paragraph at a time, this implementation is written to handle single paragraphs. Thus rule P1 is presumed by this implementation-- the data provided to the implementation is assumed to be a single paragraph, and either contains no 'B' codes, or a single 'B' code at the end of the input. 'B' is allowed as input to illustrate how the algorithm assigns it a level.
Also note that rules L3 and L4 depend on the rendering engine that uses the result of the bidi algorithm. This implementation assumes that the rendering engine expects combining marks in visual order (e.g. to the left of their base character in RTL runs) and that it adjust the glyphs used to render mirrored characters that are in RTL runs so that they render appropriately.
Doug - Felt| Field Summary | ||
|---|---|---|
| public static final byte | L | Left-to-right |
| public static final byte | LRE | Left-to-Right Embedding |
| public static final byte | LRO | Left-to-Right Override |
| public static final byte | R | Right-to-Left |
| public static final byte | AL | Right-to-Left Arabic |
| public static final byte | RLE | Right-to-Left Embedding |
| public static final byte | RLO | Right-to-Left Override |
| public static final byte | Pop Directional Format | |
| public static final byte | EN | European Number |
| public static final byte | ES | European Number Separator |
| public static final byte | ET | European Number Terminator |
| public static final byte | AN | Arabic Number |
| public static final byte | CS | Common Number Separator |
| public static final byte | NSM | Non-Spacing Mark |
| public static final byte | BN | Boundary Neutral |
| public static final byte | B | Paragraph Separator |
| public static final byte | S | Segment Separator |
| public static final byte | WS | Whitespace |
| public static final byte | ON | Other Neutrals |
| public static final byte | TYPE_MIN | Minimum bidi type value. |
| public static final byte | TYPE_MAX | Maximum bidi type value. |
| Method from com.lowagie.text.pdf.BidiOrder Summary: |
|---|
| getBaseLevel, getDirection, getLevels, getLevels, getReordering |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from com.lowagie.text.pdf.BidiOrder Detail: |
|---|
|
|
|
Rule L1. The returned levels array contains the resolved level for each bidi code passed to the constructor. The linebreaks array must include at least one value. The values must be in strictly increasing order (no duplicates) between 1 and the length of the text, inclusive. The last value must be the length of the text. |
The reordering array maps from a visual index to a logical index. Lines are concatenated from left to right. So for example, the fifth character from the left on the third line is getReordering(linebreaks)[linebreaks[1] + 4](linebreaks[1] is the position after the last character of the second line, which is also the index of the first character on the third line, and adding four gets the fifth character from the left). The linebreaks array must include at least one value. The values must be in strictly increasing order (no duplicates) between 1 and the length of the text, inclusive. The last value must be the length of the text. |