Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.hyphenation
Class Hyphenator

    java.lang.Object
      org.apache.fop.hyphenation.Hyphenator

public class Hyphenator
extends java.lang.Object

This class is the main entry point to the hyphenation package. You can use only the static methods or create an instance.

Author:
  Carlos Villegas

Field Summary
`protected static org.apache.commons.logging.Log` | `log` logging instance

Constructor Summary
`Hyphenator(java.lang.String lang, java.lang.String country, int leftMin, int rightMin)` Creates a new hyphenator.

Method Summary
`static HyphenationTree` | `getFopHyphenationTree(java.lang.String key)` Returns a hyphenation tree.
`static HyphenationTree` | `getHyphenationTree(java.lang.String lang, java.lang.String country)` Returns a hyphenation tree for a given language and country.
`static HyphenationTree` | `getHyphenationTree(java.lang.String lang, java.lang.String country, HyphenationTreeResolver resolver)` Returns a hyphenation tree for a given language and country.
`static HyphenationTreeCache` | `getHyphenationTreeCache()`
`static HyphenationTree` | `getUserHyphenationTree(java.lang.String key, HyphenationTreeResolver resolver)` Load tree from serialized file or xml file using configuration settings
`static HyphenationTree` | `getUserHyphenationTree(java.lang.String key, java.lang.String hyphenDir)` Load tree from serialized file or xml file using configuration settings
`Hyphenation` | `hyphenate(char[] word, int offset, int len)` Hyphenates a word.
`Hyphenation` | `hyphenate(java.lang.String word)` Hyphenates a word.
`static Hyphenation` | `hyphenate(java.lang.String lang, java.lang.String country, char[] word, int offset, int len, int leftMin, int rightMin)` Hyphenates a word.
`static Hyphenation` | `hyphenate(java.lang.String lang, java.lang.String country, HyphenationTreeResolver resolver, char[] word, int offset, int len, int leftMin, int rightMin)` Hyphenates a word.
`static Hyphenation` | `hyphenate(java.lang.String lang, java.lang.String country, HyphenationTreeResolver resolver, java.lang.String word, int leftMin, int rightMin)` Hyphenates a word.
`static Hyphenation` | `hyphenate(java.lang.String lang, java.lang.String country, java.lang.String word, int leftMin, int rightMin)` Hyphenates a word.
`void` | `setLanguage(java.lang.String lang, java.lang.String country)` Sets the language and country for the hyphenation process.
`void` | `setMinPushCharCount(int min)` Sets the minimum number of characters after the hyphenation point
`void` | `setMinRemainCharCount(int min)` Sets the minimum number of characters before the hyphenation point

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

Field Detail

### log

    protected static org.apache.commons.logging.Log log

  logging instance

Constructor Detail

### Hyphenator

    public Hyphenator(java.lang.String lang,
                      java.lang.String country,
                      int leftMin,
                      int rightMin)

  Creates a new hyphenator.

Parameters:
  `lang` - the language
  `country` - the country (may be null or "none")
  `leftMin` - the minimum number of characters before the hyphenation point
  `rightMin` - the minimum number of characters after the hyphenation point

Method Detail

### getHyphenationTreeCache

    public static HyphenationTreeCache getHyphenationTreeCache()

  Returns:
    the default (static) hyphenation tree cache

### getHyphenationTree

    public static HyphenationTree getHyphenationTree(java.lang.String lang,
                                                     java.lang.String country)

  Returns a hyphenation tree for a given language and country. The hyphenation trees are cached.

  Parameters:
    `lang` - the language
    `country` - the country (may be null or "none")
  Returns:
    the hyphenation tree

### getHyphenationTree

    public static HyphenationTree getHyphenationTree(java.lang.String lang,
                                                     java.lang.String country,
                                                     HyphenationTreeResolver resolver)

  Returns a hyphenation tree for a given language and country. The hyphenation trees are cached.

  Parameters:
    `lang` - the language
    `country` - the country (may be null or "none")
    `resolver` - resolver to find the hyphenation files
  Returns:
    the hyphenation tree

### getFopHyphenationTree

    public static HyphenationTree getFopHyphenationTree(java.lang.String key)

  Returns a hyphenation tree. This method looks in the resources (getResourceStream) for the hyphenation patterns.

  Parameters:
    `key` - the language/country key
  Returns:
    the hyphenation tree or null if it wasn't found in the resources

### getUserHyphenationTree

    public static HyphenationTree getUserHyphenationTree(java.lang.String key,
                                                         java.lang.String hyphenDir)

  Load tree from serialized file or xml file using configuration settings

  Parameters:
    `key` - language key for the requested hyphenation file
    `hyphenDir` - base directory to find hyphenation files in
  Returns:
    the requested HypenationTree or null if it is not available

### getUserHyphenationTree

    public static HyphenationTree getUserHyphenationTree(java.lang.String key,
                                                         HyphenationTreeResolver resolver)

  Load tree from serialized file or xml file using configuration settings

  Parameters:
    `key` - language key for the requested hyphenation file
    `resolver` - resolver to find the hyphenation files
  Returns:
    the requested HypenationTree or null if it is not available

### hyphenate

    public static Hyphenation hyphenate(java.lang.String lang,
                                        java.lang.String country,
                                        HyphenationTreeResolver resolver,
                                        java.lang.String word,
                                        int leftMin,
                                        int rightMin)

  Hyphenates a word.

  Parameters:
    `lang` - the language
    `country` - the optional country code (may be null or "none")
    `resolver` - resolver to find the hyphenation files
    `word` - the word to hyphenate
    `leftMin` - the minimum number of characters before the hyphenation point
    `rightMin` - the minimum number of characters after the hyphenation point
  Returns:
    the hyphenation result

### hyphenate

    public static Hyphenation hyphenate(java.lang.String lang,
                                        java.lang.String country,
                                        java.lang.String word,
                                        int leftMin,
                                        int rightMin)

  Hyphenates a word.

  Parameters:
    `lang` - the language
    `country` - the optional country code (may be null or "none")
    `word` - the word to hyphenate
    `leftMin` - the minimum number of characters before the hyphenation point
    `rightMin` - the minimum number of characters after the hyphenation point
  Returns:
    the hyphenation result

### hyphenate

    public static Hyphenation hyphenate(java.lang.String lang,
                                        java.lang.String country,
                                        HyphenationTreeResolver resolver,
                                        char[] word,
                                        int offset,
                                        int len,
                                        int leftMin,
                                        int rightMin)

  Hyphenates a word.

  Parameters:
    `lang` - the language
    `country` - the optional country code (may be null or "none")
    `resolver` - resolver to find the hyphenation files
    `word` - the word to hyphenate
    `offset` - the offset of the first character in the "word" character array
    `len` - the length of the word
    `leftMin` - the minimum number of characters before the hyphenation point
    `rightMin` - the minimum number of characters after the hyphenation point
  Returns:
    the hyphenation result

### hyphenate

    public static Hyphenation hyphenate(java.lang.String lang,
                                        java.lang.String country,
                                        char[] word,
                                        int offset,
                                        int len,
                                        int leftMin,
                                        int rightMin)

  Hyphenates a word.

  Parameters:
    `lang` - the language
    `country` - the optional country code (may be null or "none")
    `word` - the word to hyphenate
    `offset` - the offset of the first character in the "word" character array
    `len` - the length of the word
    `leftMin` - the minimum number of characters before the hyphenation point
    `rightMin` - the minimum number of characters after the hyphenation point
  Returns:
    the hyphenation result

### setMinRemainCharCount

    public void setMinRemainCharCount(int min)

  Sets the minimum number of characters before the hyphenation point

  Parameters:
    `min` - the number of characters

### setMinPushCharCount

    public void setMinPushCharCount(int min)

  Sets the minimum number of characters after the hyphenation point

  Parameters:
    `min` - the number of characters

### setLanguage

    public void setLanguage(java.lang.String lang,
                            java.lang.String country)

  Sets the language and country for the hyphenation process.

  Parameters:
    `lang` - the language
    `country` - the country (may be null or "none")

### hyphenate

    public Hyphenation hyphenate(char[] word,
                                 int offset,
                                 int len)

  Hyphenates a word.

  Parameters:
    `word` - the word to hyphenate
    `offset` - the offset of the first character in the "word" character array
    `len` - the length of the word
  Returns:
    the hyphenation result

### hyphenate

    public Hyphenation hyphenate(java.lang.String word)

  Hyphenates a word.

  Parameters:
    `word` - the word to hyphenate
  Returns:
    the hyphenation result

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.