Class BreakPointHandler.Builder

  • Enclosing class:
    BreakPointHandler

    public static class BreakPointHandler.Builder
    extends Object
    Provides a builder for break point handlers.
    • 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 applies
        length - the length of segment that should be replaced
        replacement - 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