Package snap.text

Class TextHyphenDict

java.lang.Object
snap.text.TextHyphenDict

public class TextHyphenDict extends Object
Module to load and process an OpenOffice.org-style hyphenation dictionary. This module is essentially a translation into Java of C code developed for OpenOffice.org by Peter Novodvorsky, which was in turn based on Raph Levien's linhnj, which was in turn based on Knuth's TeX algorithm.
  • Constructor Details

    • TextHyphenDict

      public TextHyphenDict()
      Create an instance based on the given filename. Reads and parses the given file into internal storage.
  • Method Details

    • getShared

      public static TextHyphenDict getShared()
      Return the shared instance of the HyphenDict.
    • getHyphen

      public int getHyphen(CharSequence anInput, int aStart, int anEnd)
      Returns the hyphen just prior to line end given chars, start index, chars end and line end.
    • getHyphen

      public int getHyphen(String aWord, int lineEnd)
    • getHyphens

      public int[] getHyphens(String aWord)
    • getHyphensBuffer

      public StringBuffer getHyphensBuffer(String aWord)
      Perform hyphenation on a word. Fills in the word's hyphenationPositions array.