Package com.lowagie.text.pdf
Class HyphenationAuto
java.lang.Object
com.lowagie.text.pdf.HyphenationAuto
- All Implemented Interfaces:
HyphenationEvent
Hyphenates words automatically accordingly to the language and country. The hyphenator engine was taken from FOP and
uses the TEX patterns. If a language is not provided and a TEX pattern for it exists, it can be easily adapted.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Hyphenator
The hyphenator engine.protected String
The second part of the hyphenated word. -
Constructor Summary
ConstructorsConstructorDescriptionHyphenationAuto
(String lang, String country, int leftMin, int rightMin) Creates a new hyphenation instance usable inChunk
. -
Method Summary
Modifier and TypeMethodDescriptionGets the second part of the hyphenated word.getHyphenatedWordPre
(String word, BaseFont font, float fontSize, float remainingWidth) Hyphenates a word and returns the first part of it.Gets the hyphen symbol.
-
Field Details
-
hyphenator
The hyphenator engine. -
post
The second part of the hyphenated word.
-
-
Constructor Details
-
HyphenationAuto
Creates a new hyphenation instance usable inChunk
.- Parameters:
lang
- the language ("en" for English, for example)country
- the country ("GB" for Great-Britain or "none" for no country, for example)leftMin
- the minimum number of letters before the hyphenrightMin
- the minimum number of letters after the hyphen
-
-
Method Details
-
getHyphenSymbol
Gets the hyphen symbol.- Specified by:
getHyphenSymbol
in interfaceHyphenationEvent
- Returns:
- the hyphen symbol
-
getHyphenatedWordPre
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) Hyphenates a word and returns the first part of it. To get the second part of the hyphenated word callgetHyphenatedWordPost()
.- Specified by:
getHyphenatedWordPre
in interfaceHyphenationEvent
- Parameters:
word
- the word to hyphenatefont
- the font used by this wordfontSize
- the font size used by this wordremainingWidth
- the width available to fit this word in- Returns:
- the first part of the hyphenated word including the hyphen symbol, if any
-
getHyphenatedWordPost
Gets the second part of the hyphenated word. Must be called aftergetHyphenatedWordPre()
.- Specified by:
getHyphenatedWordPost
in interfaceHyphenationEvent
- Returns:
- the second part of the hyphenated word
-