org.apache.fop.complexscripts.bidi

## 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).

- - ### Field Summary

    - ### Fields inherited from interface org.apache.fop.complexscripts.bidi.BidiConstants

      `AL, AN, B, BN, CS, EN, ES, ET, FIRST, L, LAST, LRE, LRO, MAX_LEVELS, NSM, ON, OVERRIDE, PDF, R, RLE, RLO, S, SURROGATE, WS`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int[]` | `resolveLevels(java.lang.CharSequence cs, Direction defaultLevel)` Resolve the directionality levels of each character in a character seqeunce.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 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

Copyright 1999-2022 The Apache Software Foundation. All Rights Reserved.