Beispiel #1
0
        private TextLine DrawLineOnPage(TextLine textLine, Page page)
        {
            StringBuilder sb1 = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();

            String[] tokens     = Regex.Split(textLine.GetText(), @"\s+");
            bool     testForFit = true;

            for (int i = 0; i < tokens.Length; i++)
            {
                String token = tokens[i] + Single.space;
                if (testForFit && textLine.GetStringWidth((sb1.ToString() + token).Trim()) < this.w)
                {
                    sb1.Append(token);
                }
                else
                {
                    if (testForFit)
                    {
                        testForFit = false;
                    }
                    sb2.Append(token);
                }
            }
            textLine.SetText(sb1.ToString().Trim());
            if (page != null)
            {
                textLine.DrawOn(page);
            }

            textLine.SetText(sb2.ToString().Trim());
            return(textLine);
        }