Class Hyphenator

java.lang.Object
com.lowagie.text.pdf.hyphenation.Hyphenator

public class Hyphenator extends Object
This class is the main entry point to the hyphenation package. You can use only the static methods or create an instance.
  • Field Details

    • defaultHyphLocation

      private static final String defaultHyphLocation
      See Also:
    • hyphenTrees

      private static Map<String,HyphenationTree> hyphenTrees
      TODO: Don't use statics
    • hyphenDir

      private static String hyphenDir
      Holds value of property hyphenDir.
    • hyphenTree

      private HyphenationTree hyphenTree
    • remainCharCount

      private int remainCharCount
    • pushCharCount

      private int pushCharCount
  • Constructor Details

    • Hyphenator

      public Hyphenator(String lang, String country, int leftMin, int rightMin)
      Parameters:
      lang - The language
      country - the Country
      leftMin - The minimum letters on the left
      rightMin - The minimum letters on the right
  • Method Details

    • getHyphenationTree

      public static HyphenationTree getHyphenationTree(String lang, String country)
      Parameters:
      lang - The language
      country - The country
      Returns:
      the hyphenation tree
    • getResourceHyphenationTree

      public static HyphenationTree getResourceHyphenationTree(String key)
      Parameters:
      key - A String of the key of the hyphenation tree
      Returns:
      a hyphenation tree
    • readHyphenationFile

      private static InputStream readHyphenationFile(String key)
    • getFileHyphenationTree

      public static HyphenationTree getFileHyphenationTree(String key)
      Parameters:
      key - The language to get the tree from
      Returns:
      a hyphenation tree or null
    • getHyphenFile

      private static File getHyphenFile(String key)
    • hyphenate

      public static Hyphenation hyphenate(String lang, String country, String word, int leftMin, int rightMin)
      Parameters:
      lang - The language
      country - The country
      word - char array containing the word
      leftMin - Minimum number of characters allowed before the hyphenation point
      rightMin - Minimum number of characters allowed after the hyphenation point
      Returns:
      a hyphenation object
    • hyphenate

      public static Hyphenation hyphenate(String lang, String country, char[] word, int offset, int len, int leftMin, int rightMin)
      Parameters:
      lang - The language
      country - The country
      word - char array that contains the word to hyphenate
      offset - Offset to the first character in word
      len - The length of the word
      leftMin - Minimum number of characters allowed before the hyphenation point
      rightMin - Minimum number of characters allowed after the hyphenation point
      Returns:
      a hyphenation object
    • getHyphenDir

      public static String getHyphenDir()
      Getter for property hyphenDir.
      Returns:
      Value of property hyphenDir.
    • setHyphenDir

      public static void setHyphenDir(String _hyphenDir)
      Setter for property hyphenDir.
      Parameters:
      _hyphenDir - New value of property hyphenDir.
    • setMinRemainCharCount

      public void setMinRemainCharCount(int min)
      Parameters:
      min - Minimum number of characters allowed before the hyphenation point
    • setMinPushCharCount

      public void setMinPushCharCount(int min)
      Parameters:
      min - Minimum number of characters allowed after the hyphenation point
    • setLanguage

      public void setLanguage(String lang, String country)
      Parameters:
      lang - The language
      country - The country
    • hyphenate

      public Hyphenation hyphenate(char[] word, int offset, int len)
      Parameters:
      word - Char array that contains the word
      offset - Offset to the first character in word
      len - Length of the word
      Returns:
      a hyphenation object
    • hyphenate

      public Hyphenation hyphenate(String word)
      Parameters:
      word - The word to hyphenate
      Returns:
      a hyphenation object