Package org.daisy.dotify.common.text
Class BreakPointHandler.Builder
- java.lang.Object
-
- org.daisy.dotify.common.text.BreakPointHandler.Builder
-
- Enclosing class:
- BreakPointHandler
public static class BreakPointHandler.Builder extends Object
Provides a builder for break point handlers.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BreakPointHandler.Builder
addHyphenationInfo(int offset, int length, String replacement)
Adds a non-standard hyphenation rule to apply if the hyphenation point within the specified range is chosen for hyphenation.BreakPointHandler
build()
Creates a new break point handler with the specified configuration.
-
-
-
Constructor Detail
-
Builder
public Builder(String str)
Creates a new builder with the string to break. All regular break points must be in supplied with the input string, represented by hyphen 0x2d, soft hyphen 0xad or space 0x20.- Parameters:
str
- the string
-
-
Method Detail
-
addHyphenationInfo
public BreakPointHandler.Builder addHyphenationInfo(int offset, int length, String replacement)
Adds a non-standard hyphenation rule to apply if the hyphenation point within the specified range is chosen for hyphenation.- Parameters:
offset
- the offset where the rule applieslength
- the length of segment that should be replacedreplacement
- the replacement string, must contain exactly one soft hyphen OR exactly one zero width space. Furthermore, the replacement string is expected to push the hyphenation point towards the end of the text.- Returns:
- returns the builder
-
build
public BreakPointHandler build()
Creates a new break point handler with the specified configuration.- Returns:
- returns a new BreakPointHandler
-
-