Class BidiOrder
java.lang.Object
com.itextpdf.text.pdf.BidiOrder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteRight-to-Left Arabicstatic final byteArabic Numberstatic final byteParagraph Separatorstatic final byteBoundary Neutralstatic final byteCommon Number Separatorstatic final byteEuropean Numberstatic final byteEuropean Number Separatorstatic final byteEuropean Number Terminatorstatic final byteLeft-to-rightstatic final byteLeft-to-Right Embeddingstatic final byteLeft-to-Right Overridestatic final byteNon-Spacing Markstatic final byteOther Neutralsstatic final bytePop Directional Formatstatic final byteRight-to-Leftstatic final byteRight-to-Left Embeddingstatic final byteRight-to-Left Overridestatic final byteSegment Separatorstatic final byteMaximum bidi type value.static final byteMinimum bidi type value.static final byteWhitespace -
Constructor Summary
ConstructorsConstructorDescriptionBidiOrder(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
Modifier and TypeMethodDescriptionbyteReturn the base level of the paragraph.static final bytegetDirection(char c) byte[]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 Details
-
L
public static final byte LLeft-to-right- See Also:
-
LRE
public static final byte LRELeft-to-Right Embedding- See Also:
-
LRO
public static final byte LROLeft-to-Right Override- See Also:
-
R
public static final byte RRight-to-Left- See Also:
-
AL
public static final byte ALRight-to-Left Arabic- See Also:
-
RLE
public static final byte RLERight-to-Left Embedding- See Also:
-
RLO
public static final byte RLORight-to-Left Override- See Also:
-
PDF
public static final byte PDFPop Directional Format- See Also:
-
EN
public static final byte ENEuropean Number- See Also:
-
ES
public static final byte ESEuropean Number Separator- See Also:
-
ET
public static final byte ETEuropean Number Terminator- See Also:
-
AN
public static final byte ANArabic Number- See Also:
-
CS
public static final byte CSCommon Number Separator- See Also:
-
NSM
public static final byte NSMNon-Spacing Mark- See Also:
-
BN
public static final byte BNBoundary Neutral- See Also:
-
B
public static final byte BParagraph Separator- See Also:
-
S
public static final byte SSegment Separator- See Also:
-
WS
public static final byte WSWhitespace- See Also:
-
ON
public static final byte ONOther Neutrals- See Also:
-
TYPE_MIN
public static final byte TYPE_MINMinimum bidi type value.- See Also:
-
TYPE_MAX
public static final byte TYPE_MAXMaximum bidi type value.- See Also:
-
-
Constructor Details
-
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 Details
-
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.
-