de.dante.extex.language.hyphenation
Interface Hyphenator

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
Language, ManagedLanguage, ModifiableLanguage
All Known Implementing Classes:
BaseHyphenationTable, FutureLanguage

public interface Hyphenator
extends java.io.Serializable

Interface for the HyphenationTable.

In the table the hyphenation patterns (see \patterns and the user hyphenations (see \hyphenation) are stored.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer, Michael Niedermair

Method Summary
 void addHyphenation(UnicodeCharList word, TypesetterOptions context)
          Add a user-defined hyphenation.
 void addPattern(Tokens pattern)
          Add a pattern to the hyphenation table.
 long getLeftHyphenmin()
          Return the value for the minimum number of characters before a hyphenation on the left hand side of a word.
 long getRightHyphenmin()
          Return the value for the minimum number of characters before a hyphenation on the right hand side of a word.
 boolean hyphenate(NodeList nodelist, TypesetterOptions context, UnicodeChar hyphen, int start, boolean forall, NodeFactory nodeFactory)
          Insert the hyphenation marks for a horizontal list of nodes.
 boolean isHyphenActive()
          Return true, if hyphenation is active, otherwise false;
 void setHyphenActive(boolean active)
          Activate or deactivate the hyphenation for this language.
 void setLeftHyphenmin(long left)
          Set the value for the minimum number of characters before a hyphenation on the left hand side of a word.
 void setRightHyphenmin(long right)
          Set the value for the minimum number of characters before a hyphenation on the right hand side of a word.
 

Method Detail

addHyphenation

public void addHyphenation(UnicodeCharList word,
                           TypesetterOptions context)
                    throws HyphenationException
Add a user-defined hyphenation.

The hyphenation template consists of a word of characters. The Unicode soft hyphenation character has a special meaning. This character is used to indicate places where a hyphenation is permitted. The other characters – i.e. normal Unicode characters – are used as-is.

Parameters:
word - the word with the hyphenation marks
context - the interpreter context
Throws:
HyphenationException - in case of an error

addPattern

public void addPattern(Tokens pattern)
                throws HyphenationException
Add a pattern to the hyphenation table.

Parameters:
pattern - the pattern word with numbers
Throws:
HyphenationException - in case of an error

getLeftHyphenmin

public long getLeftHyphenmin()
                      throws HyphenationException
Return the value for the minimum number of characters before a hyphenation on the left hand side of a word.

Returns:
the value \lefthyphenmin
Throws:
HyphenationException - in case of an error

getRightHyphenmin

public long getRightHyphenmin()
                       throws HyphenationException
Return the value for the minimum number of characters before a hyphenation on the right hand side of a word.

Returns:
the value \righthyphenmin
Throws:
HyphenationException - in case of an error

hyphenate

public boolean hyphenate(NodeList nodelist,
                         TypesetterOptions context,
                         UnicodeChar hyphen,
                         int start,
                         boolean forall,
                         NodeFactory nodeFactory)
                  throws HyphenationException
Insert the hyphenation marks for a horizontal list of nodes. The hyphenation marks are made up of discretionary nodes.

Parameters:
nodelist - the horizontal node list
context - the context
hyphen - the tokens to be inserted for hyphens
start - the start index
forall - the indicator that all words to the end should be processed. if false then only the next word is hyphenated.
nodeFactory - the node factory
Returns:
true iff the hyphenator is responsible for this word. Usually this means that some hyphenation marks have been inserted.
Throws:
HyphenationException - in case of an error

isHyphenActive

public boolean isHyphenActive()
                       throws HyphenationException
Return true, if hyphenation is active, otherwise false;

Returns:
true iff the hyphenation for this language is enabled
Throws:
HyphenationException - in case of an error

setHyphenActive

public void setHyphenActive(boolean active)
                     throws HyphenationException
Activate or deactivate the hyphenation for this language. If the hyphenation is deactivated then no hyphenation should be added automatically.

Parameters:
active - the indicator that the hyphenation is activated
Throws:
HyphenationException - in case of an error

setLeftHyphenmin

public void setLeftHyphenmin(long left)
                      throws HyphenationException
Set the value for the minimum number of characters before a hyphenation on the left hand side of a word.

Parameters:
left - the new value
Throws:
HyphenationException - in case of an error

setRightHyphenmin

public void setRightHyphenmin(long right)
                       throws HyphenationException
Set the value for the minimum number of characters before a hyphenation on the right hand side of a word.

Parameters:
right - the new value
Throws:
HyphenationException - in case of an error