|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.BidiOrder
public final class BidiOrder
Field Summary | |
---|---|
static byte |
AL
Right-to-Left Arabic |
static byte |
AN
Arabic Number |
static byte |
B
Paragraph Separator |
private static char[] |
baseTypes
|
static byte |
BN
Boundary Neutral |
static byte |
CS
Common Number Separator |
private byte[] |
embeddings
|
static byte |
EN
European Number |
static byte |
ES
European Number Separator |
static byte |
ET
European Number Terminator |
private byte[] |
initialTypes
|
static byte |
L
Left-to-right |
static byte |
LRE
Left-to-Right Embedding |
static byte |
LRO
Left-to-Right Override |
static byte |
NSM
Non-Spacing Mark |
static byte |
ON
Other Neutrals |
private byte |
paragraphEmbeddingLevel
|
static byte |
PDF
Pop Directional Format |
static byte |
R
Right-to-Left |
private byte[] |
resultLevels
|
private byte[] |
resultTypes
|
static byte |
RLE
Right-to-Left Embedding |
static byte |
RLO
Right-to-Left Override |
private static byte[] |
rtypes
|
static byte |
S
Segment Separator |
private int |
textLength
|
static byte |
TYPE_MAX
Maximum bidi type value. |
static byte |
TYPE_MIN
Minimum bidi type value. |
static byte |
WS
Whitespace |
Constructor Summary | |
---|---|
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 | |
---|---|
private static int[] |
computeMultilineReordering(byte[] levels,
int[] linebreaks)
Return multiline reordering array for a given level array. |
private static int[] |
computeReordering(byte[] levels)
Return reordering array for a given level array. |
private void |
determineExplicitEmbeddingLevels()
Process embedding format codes. |
private void |
determineParagraphEmbeddingLevel()
1) determining the paragraph level. |
private int |
findRunLimit(int index,
int limit,
byte[] validSet)
Return the limit of the run starting at index that includes only resultTypes in validSet. |
private int |
findRunStart(int index,
byte[] validSet)
Return the start of the run including index that includes only resultTypes in validSet. |
byte |
getBaseLevel()
Return the base level of the paragraph. |
static byte |
getDirection(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. |
private static boolean |
isWhitespace(byte biditype)
Return true if the type is considered a whitespace type for the line break rules. |
private static byte[] |
processEmbeddings(byte[] resultTypes,
byte paragraphEmbeddingLevel)
2) determining explicit levels Rules X1 - X8 The interaction of these rules makes handling them a bit complex. |
private int |
reinsertExplicitCodes(int textLength)
Reinsert levels information for explicit codes. |
private int |
removeExplicitCodes()
Rules X9. |
private void |
resolveImplicitLevels(int start,
int limit,
byte level,
byte sor,
byte eor)
7) resolving implicit embedding levels Rules I1, I2. |
private void |
resolveNeutralTypes(int start,
int limit,
byte level,
byte sor,
byte eor)
6) resolving neutral types Rules N1-N2. |
private void |
resolveWeakTypes(int start,
int limit,
byte level,
byte sor,
byte eor)
3) resolving weak types Rules W1-W7. |
private void |
runAlgorithm()
The algorithm. |
private void |
setLevels(int start,
int limit,
byte newLevel)
Set resultLevels from start up to (but not including) limit to newLevel. |
private void |
setTypes(int start,
int limit,
byte newType)
Set resultTypes from start up to (but not including) limit to newType. |
private static byte |
typeForLevel(int level)
Return the strong type (L or R) corresponding to the level. |
private static void |
validateLineBreaks(int[] linebreaks,
int textLength)
Throw exception if line breaks array is invalid. |
private static void |
validateParagraphEmbeddingLevel(byte paragraphEmbeddingLevel)
Throw exception if paragraph embedding level is invalid. |
private static void |
validateTypes(byte[] types)
Throw exception if type array is invalid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private byte[] initialTypes
private byte[] embeddings
private byte paragraphEmbeddingLevel
private int textLength
private byte[] resultTypes
private byte[] resultLevels
public static final byte L
public static final byte LRE
public static final byte LRO
public static final byte R
public static final byte AL
public static final byte RLE
public static final byte RLO
public static final byte PDF
public static final byte EN
public static final byte ES
public static final byte ET
public static final byte AN
public static final byte CS
public static final byte NSM
public static final byte BN
public static final byte B
public static final byte S
public static final byte WS
public static final byte ON
public static final byte TYPE_MIN
public static final byte TYPE_MAX
private static final byte[] rtypes
private static char[] baseTypes
Constructor Detail |
---|
public BidiOrder(byte[] types)
types
- the types arraypublic BidiOrder(byte[] types, byte paragraphEmbeddingLevel)
types
- the types arrayparagraphEmbeddingLevel
- the externally supplied paragraph embedding level.public BidiOrder(char[] text, int offset, int length, byte paragraphEmbeddingLevel)
Method Detail |
---|
public static final byte getDirection(char c)
private void runAlgorithm()
private void determineParagraphEmbeddingLevel()
Rules P2, P3.
At the end of this function, the member variable paragraphEmbeddingLevel is set to either 0 or 1.
private void determineExplicitEmbeddingLevels()
Calls processEmbeddings to generate an embedding array from the explicit format codes. The embedding overrides in the array are then applied to the result types, and the result levels are initialized.
processEmbeddings(byte[], byte)
private int removeExplicitCodes()
private int reinsertExplicitCodes(int textLength)
textLength
- the length of the data after compression
private static byte[] processEmbeddings(byte[] resultTypes, byte paragraphEmbeddingLevel)
private void resolveWeakTypes(int start, int limit, byte level, byte sor, byte eor)
private void resolveNeutralTypes(int start, int limit, byte level, byte sor, byte eor)
private void resolveImplicitLevels(int start, int limit, byte level, byte sor, byte eor)
public byte[] getLevels()
public byte[] getLevels(int[] linebreaks)
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.
linebreaks
- the offsets at which to break the paragraph
public int[] getReordering(int[] 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.
linebreaks
- the offsets at which to break the paragraph.private static int[] computeMultilineReordering(byte[] levels, int[] linebreaks)
private static int[] computeReordering(byte[] levels)
public byte getBaseLevel()
private static boolean isWhitespace(byte biditype)
private static byte typeForLevel(int level)
private int findRunLimit(int index, int limit, byte[] validSet)
private int findRunStart(int index, byte[] validSet)
private void setTypes(int start, int limit, byte newType)
private void setLevels(int start, int limit, byte newLevel)
private static void validateTypes(byte[] types)
private static void validateParagraphEmbeddingLevel(byte paragraphEmbeddingLevel)
private static void validateLineBreaks(int[] linebreaks, int textLength)
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |