Class ArabicLigaturizer


  • class ArabicLigaturizer
    extends java.lang.Object
    Shape arabic characters. This code was inspired by an LGPL'ed C library: Pango ( see http://www.pango.com/ ). Note that the code of this is the original work of Paulo Soares. Hence it is perfectly justifiable to distribute it under the MPL.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static char ALEF  
      private static char ALEFHAMZA  
      private static char ALEFHAMZABELOW  
      private static char ALEFMADDA  
      private static char ALEFMAKSURA  
      (package private) static int ar_composedtashkeel  
      (package private) static int ar_lig  
      (package private) static int ar_novowel  
      private static char[][] chartable  
      private static char DAMMA  
      (package private) static int DIGIT_TYPE_AN
      Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
      (package private) static int DIGIT_TYPE_AN_EXTENDED
      Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
      private static int DIGIT_TYPE_MASK
      Bit mask for digit type options.
      (package private) static int DIGITS_AN2EN
      Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
      (package private) static int DIGITS_EN2AN
      Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
      (package private) static int DIGITS_EN2AN_INIT_AL
      Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
      (package private) static int DIGITS_EN2AN_INIT_LR
      Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC).
      private static int DIGITS_MASK
      Bit mask for digit shaping options.
      private static int DIGITS_RESERVED
      Not a valid option value.
      private static char FARSIYEH  
      private static char FATHA  
      private static char HAMZA  
      private static char HAMZAABOVE  
      private static char HAMZABELOW  
      private static char KASRA  
      private static char LAM  
      private static char LAM_ALEF  
      private static char LAM_ALEFHAMZA  
      private static char LAM_ALEFHAMZABELOW  
      private static char LAM_ALEFMADDA  
      private static char MADDA  
      private static char SHADDA  
      private static char TATWEEL  
      private static char WAW  
      private static char WAWHAMZA  
      private static char YEH  
      private static char YEHHAMZA  
      private static char ZWJ  
    • Field Detail

      • chartable

        private static final char[][] chartable
      • DIGITS_EN2AN

        static final int DIGITS_EN2AN
        Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.
        See Also:
        Constant Field Values
      • DIGITS_AN2EN

        static final int DIGITS_AN2EN
        Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).
        See Also:
        Constant Field Values
      • DIGITS_EN2AN_INIT_LR

        static final int DIGITS_EN2AN_INIT_LR
        Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). The initial state at the start of the text is assumed to be not an Arabic, letter, so European digits at the start of the text will not change. Compare to DIGITS_ALEN2AN_INIT_AL.
        See Also:
        Constant Field Values
      • DIGITS_EN2AN_INIT_AL

        static final int DIGITS_EN2AN_INIT_AL
        Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). The initial state at the start of the text is assumed to be an Arabic, letter, so European digits at the start of the text will change. Compare to DIGITS_ALEN2AN_INT_LR.
        See Also:
        Constant Field Values
      • DIGITS_RESERVED

        private static final int DIGITS_RESERVED
        Not a valid option value.
        See Also:
        Constant Field Values
      • DIGITS_MASK

        private static final int DIGITS_MASK
        Bit mask for digit shaping options.
        See Also:
        Constant Field Values
      • DIGIT_TYPE_AN

        static final int DIGIT_TYPE_AN
        Digit type option: Use Arabic-Indic digits (U+0660...U+0669).
        See Also:
        Constant Field Values
      • DIGIT_TYPE_AN_EXTENDED

        static final int DIGIT_TYPE_AN_EXTENDED
        Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).
        See Also:
        Constant Field Values
      • DIGIT_TYPE_MASK

        private static final int DIGIT_TYPE_MASK
        Bit mask for digit type options.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ArabicLigaturizer

        ArabicLigaturizer()
    • Method Detail

      • isVowel

        private static boolean isVowel​(char s)
      • charshape

        private static char charshape​(char s,
                                      int which)
      • shapecount

        private static int shapecount​(char s)
      • doublelig

        private static void doublelig​(java.lang.StringBuffer string,
                                      int level)
      • shape

        private static void shape​(char[] text,
                                  java.lang.StringBuffer string,
                                  int level)
      • arabic_shape

        static int arabic_shape​(char[] src,
                                int srcoffset,
                                int srclength,
                                char[] dest,
                                int destoffset,
                                int destlength,
                                int level)
      • processNumbers

        static void processNumbers​(char[] text,
                                   int offset,
                                   int length,
                                   int options)
      • shapeToArabicDigitsWithContext

        private static void shapeToArabicDigitsWithContext​(char[] dest,
                                                           int start,
                                                           int length,
                                                           char digitBase,
                                                           boolean lastStrongWasAL)