Package com.lowagie.text.pdf.hyphenation
Class SimplePatternParser
java.lang.Object
com.lowagie.text.pdf.hyphenation.SimplePatternParser
- All Implemented Interfaces:
PatternConsumer
,SimpleXMLDocHandler
Parses the xml hyphenation pattern.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) PatternConsumer
(package private) int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) static final int
(package private) char
(package private) SimpleXMLParser
(package private) StringBuffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a character class.void
addException
(String w, ArrayList e) Add a hyphenation exception.void
addPattern
(String p, String v) Add hyphenation patterns.void
Called after the document is parsed.void
endElement
(String tag) Called when an end tag is found.protected String
getExceptionWord
(List<Object> ex) protected static String
protected static String
getPattern
(String word) static void
normalizeException
(List<Object> ex) void
parse
(InputStream stream, PatternConsumer consumer) void
Called when the document starts to be parsed.void
startElement
(String tag, Map<String, String> h) Called when a start tag is found.void
Called when a text element is found.
-
Field Details
-
ELEM_CLASSES
static final int ELEM_CLASSES- See Also:
-
ELEM_EXCEPTIONS
static final int ELEM_EXCEPTIONS- See Also:
-
ELEM_PATTERNS
static final int ELEM_PATTERNS- See Also:
-
ELEM_HYPHEN
static final int ELEM_HYPHEN- See Also:
-
currElement
int currElement -
consumer
PatternConsumer consumer -
token
StringBuffer token -
exception
-
hyphenChar
char hyphenChar -
parser
SimpleXMLParser parser
-
-
Constructor Details
-
SimplePatternParser
public SimplePatternParser()Creates a new instance of PatternParser2
-
-
Method Details
-
getPattern
-
getInterletterValues
-
main
-
parse
-
normalizeException
-
getExceptionWord
-
endDocument
public void endDocument()Description copied from interface:SimpleXMLDocHandler
Called after the document is parsed.- Specified by:
endDocument
in interfaceSimpleXMLDocHandler
-
endElement
Description copied from interface:SimpleXMLDocHandler
Called when an end tag is found.- Specified by:
endElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag name
-
startDocument
public void startDocument()Description copied from interface:SimpleXMLDocHandler
Called when the document starts to be parsed.- Specified by:
startDocument
in interfaceSimpleXMLDocHandler
-
startElement
Description copied from interface:SimpleXMLDocHandler
Called when a start tag is found.- Specified by:
startElement
in interfaceSimpleXMLDocHandler
- Parameters:
tag
- the tag nameh
- the tag's attributes
-
text
Description copied from interface:SimpleXMLDocHandler
Called when a text element is found.- Specified by:
text
in interfaceSimpleXMLDocHandler
- Parameters:
str
- the text element, probably a fragment.
-
addClass
Description copied from interface:PatternConsumer
Add a character class. A character class defines characters that are considered equivalent for the purpose of hyphenation (e.g. "aA"). It usually means to ignore case.- Specified by:
addClass
in interfacePatternConsumer
- Parameters:
c
- character group
-
addException
Description copied from interface:PatternConsumer
Add a hyphenation exception. An exception replaces the result obtained by the algorithm for cases for which this fails or the user wants to provide his own hyphenation. A hyphenatedword is a vector of alternating String's andHyphen
instances- Specified by:
addException
in interfacePatternConsumer
- Parameters:
w
- The word to changee
- A vector of alternating String's andHyphen
instances
-
addPattern
Description copied from interface:PatternConsumer
Add hyphenation patterns.- Specified by:
addPattern
in interfacePatternConsumer
- Parameters:
p
- the patternv
- interletter values expressed as a string of digit characters.
-