Class UnicodeBidiAlgorithm

java.lang.Object
org.apache.fop.complexscripts.bidi.UnicodeBidiAlgorithm
All Implemented Interfaces:
BidiConstants

public final class UnicodeBidiAlgorithm extends 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 Details

    • resolveLevels

      public static int[] resolveLevels(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 string
      defaultLevel - 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 values
      defaultLevel - 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 values
      classes - array containing one bidi class per character in chars array
      defaultLevel - the default paragraph level, which must be zero (LR) or one (RL)
      levels - array to receive levels, one for each character in chars array
      useRuleL1 - 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