fop 2.2

org.apache.fop.hyphenation
Class Hyphenator

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

public final 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.

This work was authored by Carlos Villegas (cav@uniscope.co.jp).


Field Summary
static java.lang.String HYPTYPE
           
static java.lang.String XMLTYPE
           
 
Method Summary
static void clearHyphenationTreeCache()
          Clears the default hyphenation tree cache.
This method can be used if the underlying data files are changed at runtime.
static HyphenationTree getFopHyphenationTree(java.lang.String key)
          Returns a hyphenation tree.
static HyphenationTree getHyphenationTree(java.lang.String lang, java.lang.String country, InternalResourceResolver resolver, java.util.Map hyphPatNames)
          Returns a hyphenation tree for a given language and country, with fallback from (lang,country) to (lang).
static HyphenationTree getHyphenationTree(java.lang.String lang, java.lang.String country, InternalResourceResolver resourceResolver, java.util.Map hyphPatNames, EventBroadcaster eventBroadcaster)
           
static HyphenationTreeCache getHyphenationTreeCache()
           
static HyphenationTree getUserHyphenationTree(java.lang.String key, InternalResourceResolver resourceResolver)
          Load tree from serialized file or xml file using configuration settings
static Hyphenation hyphenate(java.lang.String lang, java.lang.String country, InternalResourceResolver resourceResolver, java.util.Map hyphPatNames, java.lang.String word, int leftMin, int rightMin)
          Hyphenates a word.
static Hyphenation hyphenate(java.lang.String lang, java.lang.String country, InternalResourceResolver resourceResolver, java.util.Map hyphPatNames, java.lang.String word, int leftMin, int rightMin, EventBroadcaster eventBroadcaster)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HYPTYPE

public static final java.lang.String HYPTYPE

XMLTYPE

public static final java.lang.String XMLTYPE
Method Detail

getHyphenationTreeCache

public static HyphenationTreeCache getHyphenationTreeCache()
Returns:
the default (static) hyphenation tree cache

clearHyphenationTreeCache

public static void clearHyphenationTreeCache()
Clears the default hyphenation tree cache.
This method can be used if the underlying data files are changed at runtime.


getHyphenationTree

public static HyphenationTree getHyphenationTree(java.lang.String lang,
                                                 java.lang.String country,
                                                 InternalResourceResolver resolver,
                                                 java.util.Map hyphPatNames)
Returns a hyphenation tree for a given language and country, with fallback from (lang,country) to (lang). The hyphenation trees are cached.

Parameters:
lang - the language
country - the country (may be null or "none")
resolver - resolver to find the hyphenation files
hyphPatNames - the map with user-configured hyphenation pattern file names
Returns:
the hyphenation tree

getHyphenationTree

public static HyphenationTree getHyphenationTree(java.lang.String lang,
                                                 java.lang.String country,
                                                 InternalResourceResolver resourceResolver,
                                                 java.util.Map hyphPatNames,
                                                 EventBroadcaster eventBroadcaster)

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,
                                                     InternalResourceResolver resourceResolver)
Load tree from serialized file or xml file using configuration settings

Parameters:
key - language key for the requested hyphenation file
resourceResolver - resource 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,
                                    InternalResourceResolver resourceResolver,
                                    java.util.Map hyphPatNames,
                                    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")
resourceResolver - resolver to find the hyphenation files
hyphPatNames - the map with user-configured hyphenation pattern file names
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,
                                    InternalResourceResolver resourceResolver,
                                    java.util.Map hyphPatNames,
                                    java.lang.String word,
                                    int leftMin,
                                    int rightMin,
                                    EventBroadcaster eventBroadcaster)

fop 2.2

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