private void LoadPatterns(HyphenatePatternsLanguage language) { //Used TEX hyphenation patterns. Read more on http://tug.org/tex-hyphen/ switch (language) { case HyphenatePatternsLanguage.EnglishUs: CreatePatterns(Resources.hyph_en_us_pat, Resources.hyph_en_us_hyp); break; case HyphenatePatternsLanguage.EnglishBritish: CreatePatterns(Resources.hyph_en_gb_pat, Resources.hyph_en_us_hyp); break; case HyphenatePatternsLanguage.Russian: CreatePatterns(Resources.hyph_ru_pat, Resources.hyph_ru_hyp); break; case HyphenatePatternsLanguage.German: CreatePatterns(Resources.hyph_de_pat, Resources.hyph_de_hyp); break; case HyphenatePatternsLanguage.Spanish: CreatePatterns(Resources.hyph_es_pat, Resources.hyph_es_hyp); break; default: throw new ArgumentOutOfRangeException("language"); } }
public ResourceHyphenatePatternsLoader(HyphenatePatternsLanguage language) { switch (language) { case HyphenatePatternsLanguage.EnglishUs: _patterns = Patterns.hyph_en_us_pat; _exceptions = Patterns.hyph_en_us_hyp; break; case HyphenatePatternsLanguage.EnglishBritish: _patterns = Patterns.hyph_en_gb_pat; _exceptions = Patterns.hyph_en_us_hyp; break; case HyphenatePatternsLanguage.Russian: _patterns = Patterns.hyph_ru_pat; _exceptions = Patterns.hyph_ru_hyp; break; case HyphenatePatternsLanguage.German1901: _patterns = Patterns.hyph_de_1901_pat; _exceptions = Patterns.hyph_de_1901_hyp; break; case HyphenatePatternsLanguage.German1996: _patterns = Patterns.hyph_de_1996_pat; _exceptions = Patterns.hyph_de_1996_hyp; break; default: throw new ArgumentOutOfRangeException("language"); } }
/// <summary> /// Implementation of Frank Liang's hyphenation algorithm /// </summary> /// <param name="language">Language for load hyphenation patterns</param> /// <param name="hyphenateSymbol">Symbol used for denote hyphenation</param> /// <param name="minWordLength">Minimum word length for hyphenation word</param> /// <param name="minLetterCount">Minimum number of characters left on line</param> /// <param name="hyphenateLastWord">Hyphenate last word, NOTE: this option work only if input text contains not one word</param> public Hyphenator(HyphenatePatternsLanguage language, string hyphenateSymbol = "­", int minWordLength = 5, int minLetterCount = 3, bool hyphenateLastWord = false) { this.hyphenateSymbol = hyphenateSymbol; this.minWordLength = minWordLength; this.minLetterCount = minLetterCount >= 0 ? minLetterCount : 0; this.hyphenateLastWord = hyphenateLastWord; LoadPatterns(language); }
/// <summary> /// Implementation of Frank Liang's hyphenation algorithm /// </summary> /// <param name="language">Language for load hyphenation patterns</param> /// <param name="hyphenateSymbol">Symbol used for denote hyphenation</param> /// <param name="minWordLength">Minimum word length for hyphenation word</param> /// <param name="minLetterCount">Minimum number of characters left on line</param> /// <param name="hyphenateLastWord">Hyphenate last word, NOTE: this option work only if input text contains not one word</param> public Hyphenator(HyphenatePatternsLanguage language, string hyphenateSymbol = "­", int minWordLength = 5, int minLetterCount = 3, bool hyphenateLastWord = false) { this.hyphenateSymbol = hyphenateSymbol; this.minWordLength = minWordLength; this.minLetterCount = minLetterCount >= 0 ? minLetterCount : 0; this.hyphenateLastWord = hyphenateLastWord; LoadPatterns(language); }
private void LoadPatterns(HyphenatePatternsLanguage language) { //Used TEX hyphenation patterns. Read more on http://tug.org/tex-hyphen/ switch (language) { case HyphenatePatternsLanguage.EnglishUs: CreatePatterns(Patterns.hyph_en_us_pat, Patterns.hyph_en_us_hyp); break; case HyphenatePatternsLanguage.EnglishBritish: CreatePatterns(Patterns.hyph_en_gb_pat, Patterns.hyph_en_us_hyp); break; case HyphenatePatternsLanguage.Russian: CreatePatterns(Patterns.hyph_ru_pat, Patterns.hyph_ru_hyp); break; default: throw new ArgumentOutOfRangeException("language"); } }