コード例 #1
0
 public float[] DrawOn(Page page, bool draw)
 {
     this.x_text = x;
     this.y_text = y + font.GetAscent();
     foreach (Paragraph paragraph in paragraphs)
     {
         int           numberOfTextLines = paragraph.list.Count;
         StringBuilder buf = new StringBuilder();
         for (int i = 0; i < numberOfTextLines; i++)
         {
             TextLine textLine = paragraph.list[i];
             buf.Append(textLine.GetText());
         }
         for (int i = 0; i < numberOfTextLines; i++)
         {
             TextLine textLine = paragraph.list[i];
             if (i == 0)
             {
                 beginParagraphPoints.Add(new float[] { x_text, y_text });
             }
             textLine.SetAltDescription((i == 0) ? buf.ToString() : Single.space);
             textLine.SetActualText((i == 0) ? buf.ToString() : Single.space);
             float[] point = DrawTextLine(page, x_text, y_text, textLine, draw);
             if (i == (numberOfTextLines - 1))
             {
                 endParagraphPoints.Add(new float[] { point[0], point[1] });
             }
             x_text = point[0] + spaceBetweenTextLines;
             y_text = point[1];
         }
         x_text  = x;
         y_text += paragraphLeading;
     }
     return(new float[] { x_text, y_text + font.GetDescent() });
 }
コード例 #2
0
        public float[] DrawOn(Page page)
        {
            this.xText = x1;
            this.yText = y1 + font.GetAscent();
            foreach (Paragraph paragraph in paragraphs)
            {
                int           numberOfTextLines = paragraph.list.Count;
                StringBuilder buf = new StringBuilder();
                for (int i = 0; i < numberOfTextLines; i++)
                {
                    TextLine textLine = paragraph.list[i];
                    buf.Append(textLine.text);
                }
                for (int i = 0; i < numberOfTextLines; i++)
                {
                    TextLine textLine = paragraph.list[i];
                    if (i == 0)
                    {
                        beginParagraphPoints.Add(new float[] { xText, yText });
                    }
                    textLine.SetAltDescription((i == 0) ? buf.ToString() : Single.space);
                    textLine.SetActualText((i == 0) ? buf.ToString() : Single.space);
                    float[] point = DrawTextLine(page, xText, yText, textLine);
                    xText = point[0];
                    if (textLine.GetTrailingSpace())
                    {
                        xText += spaceBetweenTextLines;
                    }
                    yText = point[1];
                }
                xText  = x1;
                yText += paragraphLeading;
            }

            float height = ((yText - paragraphLeading) - y1) + font.descent;

            if (page != null && drawBorder)
            {
                Box box = new Box();
                box.SetLocation(x1, y1);
                box.SetSize(width, height);
                box.DrawOn(page);
            }

            return(new float[] { x1 + width, y1 + height });
        }
コード例 #3
0
        public TextFrame DrawOn(Page page, bool draw)
        {
            this.x_text = x;
            this.y_text = y + font.GetAscent();

            Paragraph paragraph = null;

            for (int i = 0; i < paragraphs.Count; i++)
            {
                paragraph = paragraphs[i];

                StringBuilder buf = new StringBuilder();
                foreach (TextLine textLine in paragraph.list)
                {
                    buf.Append(textLine.GetText());
                    buf.Append(Single.space);
                }

                int numOfTextLines = paragraph.list.Count;
                for (int j = 0; j < numOfTextLines; j++)
                {
                    TextLine textLine = paragraph.list[j];
                    if (j == 0)
                    {
                        beginParagraphPoints.Add(new float[] { x_text, y_text });
                    }
                    textLine.SetAltDescription((i == 0) ? buf.ToString() : Single.space);
                    textLine.SetActualText((i == 0) ? buf.ToString() : Single.space);

                    TextLine textLine2 = DrawTextLine(page, x_text, y_text, textLine, draw);
                    if (!textLine2.GetText().Equals(""))
                    {
                        List <Paragraph> theRest    = new List <Paragraph>();
                        Paragraph        paragraph2 = new Paragraph(textLine2);
                        j++;
                        while (j < numOfTextLines)
                        {
                            paragraph2.Add(paragraph.list[j]);
                            j++;
                        }
                        theRest.Add(paragraph2);
                        i++;
                        while (i < paragraphs.Count)
                        {
                            theRest.Add(paragraphs[i]);
                            i++;
                        }
                        return(new TextFrame(theRest));
                    }

                    if (j == (numOfTextLines - 1))
                    {
                        endParagraphPoints.Add(new float[] { textLine2.x, textLine2.y });
                    }
                    x_text = textLine2.x;
                    if (textLine.GetTrailingSpace())
                    {
                        x_text += spaceBetweenTextLines;
                    }
                    y_text = textLine2.y;
                }
                x_text  = x;
                y_text += paragraphLeading;
            }

            TextFrame textFrame = new TextFrame(null);

            textFrame.SetLocation(x_text, y_text + font.GetDescent());
            return(textFrame);
        }