Class UnicodeBidiAlgorithm
- java.lang.Object
-
- org.apache.fop.complexscripts.bidi.UnicodeBidiAlgorithm
-
- All Implemented Interfaces:
BidiConstants
public final class UnicodeBidiAlgorithm extends java.lang.Object implements BidiConstants
The
UnicodeBidiAlgorithm
class implements functionality prescribed by the Unicode Bidirectional Algorithm, Unicode Standard Annex #9.This work was originally authored by Glenn Adams (gadams@apache.org).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
resolveLevels(int[] chars, int[] classes, int defaultLevel, int[] levels, boolean useRuleL1)
Resolve the directionality levels of each character in a character seqeunce.static int[]
resolveLevels(int[] chars, int defaultLevel, int[] levels)
Resolve the directionality levels of each character in a character seqeunce.static int[]
resolveLevels(java.lang.CharSequence cs, Direction defaultLevel)
Resolve the directionality levels of each character in a character seqeunce.
-
-
-
Method Detail
-
resolveLevels
public static int[] resolveLevels(java.lang.CharSequence cs, Direction defaultLevel)
Resolve the directionality levels of each character in a character seqeunce. If some character is encoded in the character sequence as a Unicode Surrogate Pair, then the directionality level of each of the two members of the pair will be identical.- Parameters:
cs
- input character sequence representing a UTF-16 encoded stringdefaultLevel
- the default paragraph level, which must be zero (LR) or one (RL)- Returns:
- null if bidirectional processing is not required; otherwise, returns an array of integers, where each integer corresponds to exactly one UTF-16 encoding element present in the input character sequence, and where each integer denotes the directionality level of the corresponding encoding element
-
resolveLevels
public static int[] resolveLevels(int[] chars, int defaultLevel, int[] levels)
Resolve the directionality levels of each character in a character seqeunce.- Parameters:
chars
- array of input characters represented as unicode scalar valuesdefaultLevel
- the default paragraph level, which must be zero (LR) or one (RL)levels
- array to receive levels, one for each character in chars array- Returns:
- null if bidirectional processing is not required; otherwise, returns an array of integers, where each integer corresponds to exactly one UTF-16 encoding element present in the input character sequence, and where each integer denotes the directionality level of the corresponding encoding element
-
resolveLevels
public static int[] resolveLevels(int[] chars, int[] classes, int defaultLevel, int[] levels, boolean useRuleL1)
Resolve the directionality levels of each character in a character seqeunce.- Parameters:
chars
- array of input characters represented as unicode scalar valuesclasses
- array containing one bidi class per character in chars arraydefaultLevel
- the default paragraph level, which must be zero (LR) or one (RL)levels
- array to receive levels, one for each character in chars arrayuseRuleL1
- true if rule L1 should be used- Returns:
- null if bidirectional processing is not required; otherwise, returns an array of integers, where each integer corresponds to exactly one UTF-16 encoding element present in the input character sequence, and where each integer denotes the directionality level of the corresponding encoding element
-
-