Package com.lowagie.text.pdf
Class ArabicLigaturizer
java.lang.Object
com.lowagie.text.pdf.ArabicLigaturizer
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char
private static final char
private static final char
private static final char
private static final char
static final int
static final int
static final int
static final int
private static final char[][]
private static final char
static final int
Digit type option: Use Arabic-Indic digits (U+0660...U+0669).static final int
Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).static final int
Bit mask for digit type options.static final int
Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).static final int
Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.static final int
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).static final int
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).static final int
Bit mask for digit shaping options.private static final int
Not a valid option value.private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
private static final char
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static int
arabic_shape
(char[] src, int srcoffset, int srclength, char[] dest, int destoffset, int destlength, int level) (package private) static char
charshape
(char s, int which) (package private) static boolean
(package private) static void
copycstostring
(StringBuffer string, ArabicLigaturizer.CharStruct s, int level) (package private) static void
doublelig
(StringBuffer string, int level) (package private) static boolean
isVowel
(char s) (package private) static int
ligature
(char newchar, ArabicLigaturizer.CharStruct oldchar) (package private) static void
processNumbers
(char[] text, int offset, int length, int options) (package private) static void
shape
(char[] text, StringBuffer string, int level) (package private) static int
shapecount
(char s) (package private) static void
shapeToArabicDigitsWithContext
(char[] dest, int start, int length, char digitBase, boolean lastStrongWasAL) Given an array of characters, process a section of it, and replace European numeral characters (0-9) with Arabic numeral characters (depending on thedigitBase
) if the characters are preceded by Arabic characters.
-
Field Details
-
ar_nothing
public static final int ar_nothing- See Also:
-
ar_novowel
public static final int ar_novowel- See Also:
-
ar_composedtashkeel
public static final int ar_composedtashkeel- See Also:
-
ar_lig
public static final int ar_lig- See Also:
-
DIGITS_EN2AN
public static final int DIGITS_EN2ANDigit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.- See Also:
-
DIGITS_AN2EN
public static final int DIGITS_AN2ENDigit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).- See Also:
-
DIGITS_EN2AN_INIT_LR
public static final int DIGITS_EN2AN_INIT_LRDigit 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:
-
DIGITS_EN2AN_INIT_AL
public static final int DIGITS_EN2AN_INIT_ALDigit 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:
-
DIGITS_MASK
public static final int DIGITS_MASKBit mask for digit shaping options.- See Also:
-
DIGIT_TYPE_AN
public static final int DIGIT_TYPE_ANDigit type option: Use Arabic-Indic digits (U+0660...U+0669).- See Also:
-
DIGIT_TYPE_AN_EXTENDED
public static final int DIGIT_TYPE_AN_EXTENDEDDigit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).- See Also:
-
DIGIT_TYPE_MASK
public static final int DIGIT_TYPE_MASKBit mask for digit type options.- See Also:
-
ALEF
private static final char ALEF- See Also:
-
ALEFHAMZA
private static final char ALEFHAMZA- See Also:
-
ALEFHAMZABELOW
private static final char ALEFHAMZABELOW- See Also:
-
ALEFMADDA
private static final char ALEFMADDA- See Also:
-
LAM
private static final char LAM- See Also:
-
HAMZA
private static final char HAMZA- See Also:
-
TATWEEL
private static final char TATWEEL- See Also:
-
ZWJ
private static final char ZWJ- See Also:
-
HAMZAABOVE
private static final char HAMZAABOVE- See Also:
-
HAMZABELOW
private static final char HAMZABELOW- See Also:
-
WAWHAMZA
private static final char WAWHAMZA- See Also:
-
YEHHAMZA
private static final char YEHHAMZA- See Also:
-
WAW
private static final char WAW- See Also:
-
ALEFMAKSURA
private static final char ALEFMAKSURA- See Also:
-
YEH
private static final char YEH- See Also:
-
FARSIYEH
private static final char FARSIYEH- See Also:
-
SHADDA
private static final char SHADDA- See Also:
-
KASRA
private static final char KASRA- See Also:
-
FATHA
private static final char FATHA- See Also:
-
DAMMA
private static final char DAMMA- See Also:
-
MADDA
private static final char MADDA- See Also:
-
LAM_ALEF
private static final char LAM_ALEF- See Also:
-
LAM_ALEFHAMZA
private static final char LAM_ALEFHAMZA- See Also:
-
LAM_ALEFHAMZABELOW
private static final char LAM_ALEFHAMZABELOW- See Also:
-
LAM_ALEFMADDA
private static final char LAM_ALEFMADDA- See Also:
-
chartable
private static final char[][] chartable -
DIGITS_RESERVED
private static final int DIGITS_RESERVEDNot a valid option value.- See Also:
-
-
Constructor Details
-
ArabicLigaturizer
public ArabicLigaturizer()
-
-
Method Details
-
isVowel
static boolean isVowel(char s) -
charshape
static char charshape(char s, int which) -
shapecount
static int shapecount(char s) -
ligature
-
copycstostring
-
doublelig
-
connects_to_left
-
shape
-
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
static void shapeToArabicDigitsWithContext(char[] dest, int start, int length, char digitBase, boolean lastStrongWasAL) Given an array of characters, process a section of it, and replace European numeral characters (0-9) with Arabic numeral characters (depending on thedigitBase
) if the characters are preceded by Arabic characters.- Parameters:
dest
- The array of characters to be processed. Must not benull
, and must have a length greater than0
.start
- The start index of the characters to be processed. The value must be greater than, or equal to,0
and less than the length of the arraydest
.length
- The number of characters to process.length
+start
must be less than, or equal to, the length of the arraydest
.digitBase
- The code of the character which represents the numeral 0 into which the European numbers should be converted. For instance, Arabic-Indic digits begin at'٠'
, and Eastern Arabic-Indic digits (Persian and Urdu) begin at'۰'
.lastStrongWasAL
- A boolean flag indicating whether or not the character preceding the array of characters to be processed was an Arabic character, or not.
-