- java.lang.Object
-
- com.itextpdf.text.pdf.BidiOrder
-
public final class BidiOrder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static byteALRight-to-Left Arabicstatic byteANArabic Numberstatic byteBParagraph Separatorstatic byteBNBoundary Neutralstatic byteCSCommon Number Separatorstatic byteENEuropean Numberstatic byteESEuropean Number Separatorstatic byteETEuropean Number Terminatorstatic byteLLeft-to-rightstatic byteLRELeft-to-Right Embeddingstatic byteLROLeft-to-Right Overridestatic byteNSMNon-Spacing Markstatic byteONOther Neutralsstatic bytePDFPop Directional Formatstatic byteRRight-to-Leftstatic byteRLERight-to-Left Embeddingstatic byteRLORight-to-Left Overridestatic byteSSegment Separatorstatic byteTYPE_MAXMaximum bidi type value.static byteTYPE_MINMinimum bidi type value.static byteWSWhitespace
-
Constructor Summary
Constructors Constructor Description BidiOrder(byte[] types)Initialize using an array of direction types.BidiOrder(byte[] types, byte paragraphEmbeddingLevel)Initialize using an array of direction types and an externally supplied paragraph embedding level.BidiOrder(char[] text, int offset, int length, byte paragraphEmbeddingLevel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description bytegetBaseLevel()Return the base level of the paragraph.static bytegetDirection(char c)byte[]getLevels()byte[]getLevels(int[] linebreaks)Return levels array breaking lines at offsets in linebreaks.int[]getReordering(int[] linebreaks)Return reordering array breaking lines at offsets in linebreaks.
-
-
-
Field Detail
-
L
public static final byte L
Left-to-right- See Also:
- Constant Field Values
-
LRE
public static final byte LRE
Left-to-Right Embedding- See Also:
- Constant Field Values
-
LRO
public static final byte LRO
Left-to-Right Override- See Also:
- Constant Field Values
-
R
public static final byte R
Right-to-Left- See Also:
- Constant Field Values
-
AL
public static final byte AL
Right-to-Left Arabic- See Also:
- Constant Field Values
-
RLE
public static final byte RLE
Right-to-Left Embedding- See Also:
- Constant Field Values
-
RLO
public static final byte RLO
Right-to-Left Override- See Also:
- Constant Field Values
-
PDF
public static final byte PDF
Pop Directional Format- See Also:
- Constant Field Values
-
EN
public static final byte EN
European Number- See Also:
- Constant Field Values
-
ES
public static final byte ES
European Number Separator- See Also:
- Constant Field Values
-
ET
public static final byte ET
European Number Terminator- See Also:
- Constant Field Values
-
AN
public static final byte AN
Arabic Number- See Also:
- Constant Field Values
-
CS
public static final byte CS
Common Number Separator- See Also:
- Constant Field Values
-
NSM
public static final byte NSM
Non-Spacing Mark- See Also:
- Constant Field Values
-
BN
public static final byte BN
Boundary Neutral- See Also:
- Constant Field Values
-
B
public static final byte B
Paragraph Separator- See Also:
- Constant Field Values
-
S
public static final byte S
Segment Separator- See Also:
- Constant Field Values
-
WS
public static final byte WS
Whitespace- See Also:
- Constant Field Values
-
ON
public static final byte ON
Other Neutrals- See Also:
- Constant Field Values
-
TYPE_MIN
public static final byte TYPE_MIN
Minimum bidi type value.- See Also:
- Constant Field Values
-
TYPE_MAX
public static final byte TYPE_MAX
Maximum bidi type value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BidiOrder
public BidiOrder(byte[] types)
Initialize using an array of direction types. Types range from TYPE_MIN to TYPE_MAX inclusive and represent the direction codes of the characters in the text.- Parameters:
types- the types array
-
BidiOrder
public BidiOrder(byte[] types, byte paragraphEmbeddingLevel)Initialize using an array of direction types and an externally supplied paragraph embedding level. The embedding level may be -1, 0, or 1. -1 means to apply the default algorithm (rules P2 and P3), 0 is for LTR paragraphs, and 1 is for RTL paragraphs.- Parameters:
types- the types arrayparagraphEmbeddingLevel- the externally supplied paragraph embedding level.
-
BidiOrder
public BidiOrder(char[] text, int offset, int length, byte paragraphEmbeddingLevel)
-
-
Method Detail
-
getDirection
public static final byte getDirection(char c)
-
getLevels
public byte[] getLevels()
-
getLevels
public byte[] getLevels(int[] linebreaks)
Return levels array breaking lines at offsets in linebreaks.
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.
- Parameters:
linebreaks- the offsets at which to break the paragraph- Returns:
- the resolved levels of the text
-
getReordering
public int[] getReordering(int[] linebreaks)
Return reordering array breaking lines at offsets in linebreaks.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.
- Parameters:
linebreaks- the offsets at which to break the paragraph.
-
getBaseLevel
public byte getBaseLevel()
Return the base level of the paragraph.
-
-