Hyphenator

class Hyphenator(val patternSet: HyphenationPatternSet, val leftMin: Int = patternSet.leftMin, val rightMin: Int = patternSet.rightMin)(source)

A hyphenator based on Frank Liang's pattern algorithm as used by TeX, with the patterns of hyph-utf8.

Use Hyphenator.forLanguage to find a hyphenator for a language, or the top level hyphenate function.

Parameters

patternSet

the patterns to use

leftMin

the minimum number of characters before a hyphenation point

rightMin

the minimum number of characters after a hyphenation point

Constructors

Link copied to clipboard
constructor(patternSet: HyphenationPatternSet, leftMin: Int = patternSet.leftMin, rightMin: Int = patternSet.rightMin)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun hyphenate(text: String, hyphen: Char = SOFT_HYPHEN): String

Returns text with hyphen inserted at the hyphenation points of every word. Words are maximal sequences of letters and marks, words that already contain a soft hyphen are left as they are.

Link copied to clipboard
fun hyphenateWord(word: String, hyphen: Char = SOFT_HYPHEN): String

Returns word with hyphen inserted at its hyphenation points.

Link copied to clipboard

Returns the hyphenation points of word: the UTF-16 indices of the characters a hyphen may be inserted before.

Link copied to clipboard

Returns the hyphenation points of all words in text: the UTF-16 indices of the characters a hyphen may be inserted before. Words are maximal sequences of letters and marks, words that already contain a soft hyphen have no hyphenation points.