public virtual void SpecialScriptRendererFollowedByRegularTextRendererGetSequenceInfo()
        {
            PdfDocument  pdfDocument           = new PdfDocument(new PdfWriter(new MemoryStream()));
            Document     document              = new Document(pdfDocument);
            TextRenderer specialScriptRenderer = new TextRenderer(new Text(THAI_TEXT));

            specialScriptRenderer.SetProperty(Property.FONT, PdfFontFactory.CreateFont(THAI_FONT, PdfEncodings.IDENTITY_H
                                                                                       ));
            specialScriptRenderer.SetText(THAI_TEXT);
            TextRenderer nonSpecialScriptRenderer = new TextRenderer(new Text("non special"));

            nonSpecialScriptRenderer.SetProperty(Property.FONT, PdfFontFactory.CreateFont(REGULAR_FONT, PdfEncodings.IDENTITY_H
                                                                                          ));
            nonSpecialScriptRenderer.SetText("non special");
            LineRenderer lineRenderer = new LineRenderer();

            lineRenderer.SetParent(document.GetRenderer());
            lineRenderer.AddChild(specialScriptRenderer);
            lineRenderer.AddChild(nonSpecialScriptRenderer);
            LineRenderer.SpecialScriptsContainingTextRendererSequenceInfo info = lineRenderer.GetSpecialScriptsContainingTextRendererSequenceInfo
                                                                                     (0);
            NUnit.Framework.Assert.AreEqual(1, info.numberOfSequentialTextRenderers);
            NUnit.Framework.Assert.AreEqual(THAI_TEXT, info.sequentialTextContent);
            NUnit.Framework.Assert.IsTrue(info.indicesOfFloating.IsEmpty());
        }
        public virtual void SpecialScriptPreLayoutProcessing()
        {
            PdfDocument  pdfDocument           = new PdfDocument(new PdfWriter(new MemoryStream()));
            Document     document              = new Document(pdfDocument);
            int          thaiTextSplitPosition = THAI_TEXT.Length / 2;
            PdfFont      font = PdfFontFactory.CreateFont(THAI_FONT, PdfEncodings.IDENTITY_H);
            TextRenderer textRendererFirstPart = new TextRenderer(new Text(THAI_TEXT.JSubstring(0, thaiTextSplitPosition
                                                                                                )));

            textRendererFirstPart.SetProperty(Property.FONT, font);
            textRendererFirstPart.SetText(THAI_TEXT.JSubstring(0, thaiTextSplitPosition));
            TextRenderer textRendererSecondPart = new TextRenderer(new Text(THAI_TEXT.Substring(thaiTextSplitPosition)
                                                                            ));

            textRendererSecondPart.SetProperty(Property.FONT, font);
            textRendererSecondPart.SetText(THAI_TEXT.Substring(thaiTextSplitPosition));
            TableRenderer floatingNonTextRenderer = new TableRenderer(new Table(3));

            floatingNonTextRenderer.SetProperty(Property.FLOAT, FloatPropertyValue.RIGHT);
            TableRenderer regularNonTextRenderer = new TableRenderer(new Table(3));
            LineRenderer  lineRenderer           = new LineRenderer();

            lineRenderer.SetParent(document.GetRenderer());
            lineRenderer.AddChild(textRendererFirstPart);
            lineRenderer.AddChild(floatingNonTextRenderer);
            lineRenderer.AddChild(textRendererSecondPart);
            lineRenderer.AddChild(regularNonTextRenderer);
            LineRenderer.SpecialScriptsContainingTextRendererSequenceInfo info = lineRenderer.GetSpecialScriptsContainingTextRendererSequenceInfo
                                                                                     (0);
            int         numberOfSequentialTextRenderers = info.numberOfSequentialTextRenderers;
            String      sequentialTextContent           = info.sequentialTextContent;
            IList <int> indicesOfFloating = info.indicesOfFloating;

            NUnit.Framework.Assert.AreEqual(3, numberOfSequentialTextRenderers);
            NUnit.Framework.Assert.AreEqual(THAI_TEXT, sequentialTextContent);
            NUnit.Framework.Assert.AreEqual(1, indicesOfFloating.Count);
            NUnit.Framework.Assert.AreEqual(1, (int)indicesOfFloating[0]);
            IList <int> possibleBreaks = new List <int>(JavaUtil.ArraysAsList(3, 8, 10, 12, 15, 20, 23, 26, 28, 30, 36));

            lineRenderer.DistributePossibleBreakPointsOverSequentialTextRenderers(0, numberOfSequentialTextRenderers,
                                                                                  possibleBreaks, indicesOfFloating);
            IList <int> possibleBreaksFirstPart = textRendererFirstPart.GetSpecialScriptsWordBreakPoints();

            NUnit.Framework.Assert.IsNotNull(possibleBreaksFirstPart);
            IList <int> possibleBreaksSecondPart = textRendererSecondPart.GetSpecialScriptsWordBreakPoints();

            NUnit.Framework.Assert.IsNotNull(possibleBreaksSecondPart);
            int         indexOfLastPossibleBreakInTheFirstRenderer = 4;
            IList <int> expectedPossibleBreaksFirstPart            = possibleBreaks.SubList(0, indexOfLastPossibleBreakInTheFirstRenderer
                                                                                            + 1);
            IList <int> expectedPossibleBreaksSecondPart = possibleBreaks.SubList(indexOfLastPossibleBreakInTheFirstRenderer
                                                                                  + 1, possibleBreaks.Count);

            NUnit.Framework.Assert.AreEqual(expectedPossibleBreaksFirstPart, possibleBreaksFirstPart);
            for (int i = 0; i < expectedPossibleBreaksSecondPart.Count; i++)
            {
                expectedPossibleBreaksSecondPart[i] = expectedPossibleBreaksSecondPart[i] - thaiTextSplitPosition;
            }
            NUnit.Framework.Assert.AreEqual(expectedPossibleBreaksSecondPart, possibleBreaksSecondPart);
        }