pub struct Hyphenator { /* private fields */ }Expand description
Hyphenates words using TeX’s pattern-matching algorithm (Knuth-Liang).
Construct with Hyphenator::plain_tex_en_us for the standard plain TeX
English patterns, or load custom patterns with Hyphenator::load_patterns.
Implementations§
Source§impl Hyphenator
impl Hyphenator
Sourcepub fn plain_tex_en_us() -> Self
pub fn plain_tex_en_us() -> Self
Construct a hyphenator loaded with plain TeX’s English (US) patterns and exceptions.
Sourcepub fn load_patterns(&mut self, patterns: &str)
pub fn load_patterns(&mut self, patterns: &str)
Load hyphenation patterns from a whitespace-separated string in TeX pattern format.
Sourcepub fn insert_exceptions(&mut self, hyphenated_words: &str)
pub fn insert_exceptions(&mut self, hyphenated_words: &str)
Add multiple hyphenation exceptions. These are separate words separated by whitespace, with
each word satisfying the format in Self::insert_exception.
Sourcepub fn insert_exception(&mut self, hyphenated_word: &str)
pub fn insert_exception(&mut self, hyphenated_word: &str)
Add a hyphenation exception. The word is given with hyphens marking the allowed break points,
e.g. "hy-phen-ation".
Sourcepub fn hypthenate<L: LowerCaser>(
&self,
lower_caser: &L,
word: &str,
target: &mut String,
)
pub fn hypthenate<L: LowerCaser>( &self, lower_caser: &L, word: &str, target: &mut String, )
Hyphenate a word, returning it with - inserted at each valid break point.
Sourcepub fn calculate_indices<L: LowerCaser>(
&self,
lower_caser: &L,
word: &str,
) -> impl Iterator<Item = usize>
pub fn calculate_indices<L: LowerCaser>( &self, lower_caser: &L, word: &str, ) -> impl Iterator<Item = usize>
Return the set of character indices before which a hyphen may be inserted.