## org.apache.batik.gvt.text
Class ArabicTextHandler

    java.lang.Object
      org.apache.batik.gvt.text.ArabicTextHandler

public class ArabicTextHandler
extends java.lang.Object

Handles the processing of arabic text. In particular it determines the form each arabic char should take. It also contains methods for substituting plain arabic glyphs with their shaped forms. This is needed when the arabic text is rendered using an AWT font.

Constructor Summary
`ArabicTextHandler()`

Method Summary
`static boolean` `arabicChar(char c)` Returns true if the char is a standard arabic char.
`static boolean` `arabicCharTransparent(char c)` Returns true if the char is transparent.
`static java.text.AttributedString` `assignArabicForms(java.text.AttributedString as)` If the AttributedString contains any arabic chars, assigns an arabic form attribute, ie.
`static boolean` `charStartsLigature(char c)` Returns true if a ligature exists that starts with the specified character.
`static boolean` `containsArabic(java.text.AttributedCharacterIterator aci)` Returns true if the ACI contains any arabic characters.
`static boolean` `containsArabic(java.text.AttributedString as)` Returns true if the string contains any arabic characters.
`static java.lang.String` `createSubstituteString(java.text.AttributedCharacterIterator aci)` Where possible substitues plain arabic glyphs with their shaped forms.
`static int` `getNumChars(char c)` Returns the number of characters the glyph for the specified character represents.
`static int` `getSubstituteChar(java.lang.String unicode, int form)` Will try and find a substitute character of the specified form.
`static boolean` `isLigature(char c)` Returns true if the glyph for the specified character respresents a ligature.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ArabicTextHandler

    public ArabicTextHandler()

Method Detail

### assignArabicForms

    public static java.text.AttributedString assignArabicForms(java.text.AttributedString as)

  If the AttributedString contains any arabic chars, assigns an arabic form attribute, ie. initial|medial|terminal|isolated, to each arabic char.

  Parameters:
    `as` - The string to attach the arabic form attributes to.
  Returns:
    An attributed string with arabic form attributes.

### arabicChar

    public static boolean arabicChar(char c)

  Returns true if the char is a standard arabic char. (ie. within the range U+0600 - U+6FF)

  Parameters:
    `c` - The character to test.
  Returns:
    True if the char is arabic, false otherwise.

### containsArabic

    public static boolean containsArabic(java.text.AttributedString as)

  Returns true if the string contains any arabic characters.

  Parameters:
    `as` - The string to test.
  Returns:
    True if at least one char is arabic, false otherwise.

### containsArabic

    public static boolean containsArabic(java.text.AttributedCharacterIterator aci)

  Returns true if the ACI contains any arabic characters.

  Parameters:
    `aci` - The AttributedCharacterIterator to test.
  Returns:
    True if at least one char is arabic, false otherwise.

### arabicCharTransparent

    public static boolean arabicCharTransparent(char c)

  Returns true if the char is transparent.

  Parameters:
    `c` - The character to test.
  Returns:
    True if the character is transparent, false otherwise.

### getSubstituteChar

    public static int getSubstituteChar(java.lang.String unicode,
                                        int form)

  Will try and find a substitute character of the specified form.

  Parameters:
    `unicode` - The unicode value of the glyph to try and replace. It may be ligature and so may contain more than one character.
    `form` - Indicates the required arabic form. (isolated = 1, final = 2, initial = 3, medial = 4)
  Returns:
    The unicode value of the substutute char, or -1 if no susbtitue exists.

### createSubstituteString

    public static java.lang.String createSubstituteString(java.text.AttributedCharacterIterator aci)

  Where possible substitues plain arabic glyphs with their shaped forms. This is needed when the arabic text is rendered using an AWT font. Simple arabic ligatures will also be recognised and replaced by a single character so the length of the resulting string may be shorter than the number of characters in the aci.

  Parameters:
    `aci` - Contains the text to process. Arabic form attributes should already be assigned to each arabic character.
  Returns:
    A String containing the shaped versions of the arabic characters.

### charStartsLigature

    public static boolean charStartsLigature(char c)

  Returns true if a ligature exists that starts with the specified character.

  Parameters:
    `c` - The character to test.
  Returns:
    True if there is a ligature that starts with c, false otherwise.

### getNumChars

    public static int getNumChars(char c)

  Returns the number of characters the glyph for the specified character represents. If the glyph represents a ligature this will be 2, otherwise 1.

  Parameters:
    `c` - The character to test.
  Returns:
    The number of characters the glyph for c represents.

### isLigature

    public static boolean isLigature(char c)

  Returns true if the glyph for the specified character respresents a ligature.

  Parameters:
    `c` - The character to test.
  Returns:
    True if c is a ligature, false otherwise.

Copyright © 2004 Apache Software Foundation. All Rights Reserved.