/** Hyphenates a word and returns the first part of it. To get * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>. * @param word the word to hyphenate * @param font the font used by this word * @param fontSize the font size used by this word * @param remainingWidth the width available to fit this word in * @return the first part of the hyphenated word including * the hyphen symbol, if any */ virtual public string GetHyphenatedWordPre(string word, BaseFont font, float fontSize, float remainingWidth) { post = word; string hyphen = this.HyphenSymbol; float hyphenWidth = font.GetWidthPoint(hyphen, fontSize); if (hyphenWidth > remainingWidth) { return(""); } Hyphenation hyphenation = hyphenator.Hyphenate(word); if (hyphenation == null) { return(""); } int len = hyphenation.Length; int k; for (k = 0; k < len; ++k) { if (font.GetWidthPoint(hyphenation.GetPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth) { break; } } --k; if (k < 0) { return(""); } post = hyphenation.GetPostHyphenText(k); return(hyphenation.GetPreHyphenText(k) + hyphen); }