iTextSharp.text.pdf.HyphenationAuto.GetHyphenatedWordPre C# (CSharp) Метод

GetHyphenatedWordPre() публичный Метод

public GetHyphenatedWordPre ( string word, BaseFont font, float fontSize, float remainingWidth ) : string
word string
font BaseFont
fontSize float
remainingWidth float
Результат string
        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;
        }