public virtual void MultipleFloatsFollowedByUnfittingThaiRenderer()
        {
            PdfDocument  pdfDocument  = new PdfDocument(new PdfWriter(new MemoryStream()));
            Document     document     = new Document(pdfDocument);
            LineRenderer lineRenderer = new LineRenderer();

            lineRenderer.SetParent(document.GetRenderer());
            PdfFont font = PdfFontFactory.CreateFont(THAI_FONT, PdfEncodings.IDENTITY_H);
            IDictionary <int, LayoutResult> specialScriptLayoutResults = new Dictionary <int, LayoutResult>();
            int indexOfThaiRenderer = 3;

            for (int i = 0; i < indexOfThaiRenderer; i++)
            {
                TableRenderer tableRenderer = new TableRenderer(new Table(3));
                tableRenderer.SetProperty(Property.FLOAT, FloatPropertyValue.LEFT);
                lineRenderer.AddChild(tableRenderer);
            }
            TextRenderer textRenderer = new TextRenderer(new Text(""));

            textRenderer.SetProperty(Property.FONT, font);
            textRenderer.SetText(THAI_WORD);
            textRenderer.SetSpecialScriptsWordBreakPoints(new List <int>(JavaUtil.ArraysAsList(THAI_WORD.Length)));
            lineRenderer.AddChild(textRenderer);
            LayoutArea layoutArea = new LayoutArea(1, new Rectangle(0, 0, 0, 100));

            specialScriptLayoutResults.Put(indexOfThaiRenderer, new LayoutResult(LayoutResult.NOTHING, layoutArea, null
                                                                                 , null));
            LineRenderer.LastFittingChildRendererData lastFittingChildRendererData = lineRenderer.GetIndexAndLayoutResultOfTheLastRendererToRemainOnTheLine
                                                                                         (indexOfThaiRenderer, specialScriptLayoutResults, false, new List <IRenderer>());
            NUnit.Framework.Assert.AreEqual(indexOfThaiRenderer, lastFittingChildRendererData.childIndex);
            NUnit.Framework.Assert.AreEqual(LayoutResult.NOTHING, lastFittingChildRendererData.childLayoutResult.GetStatus
                                                ());
        }
        public virtual void TrailingRightSideSpacesGetIndexAndLayoutResult()
        {
            PdfDocument  pdfDocument  = new PdfDocument(new PdfWriter(new MemoryStream()));
            Document     document     = new Document(pdfDocument);
            LineRenderer lineRenderer = new LineRenderer();

            lineRenderer.SetParent(document.GetRenderer());
            PdfFont font = PdfFontFactory.CreateFont(THAI_FONT, PdfEncodings.IDENTITY_H);
            IDictionary <int, LayoutResult> specialScriptLayoutResults = new Dictionary <int, LayoutResult>();

            for (int i = 0; i < THAI_WORD.Length; i++)
            {
                TextRenderer textRenderer = new TextRenderer(new Text(""));
                textRenderer.SetProperty(Property.FONT, font);
                if (i == THAI_WORD.Length - 1)
                {
                    textRenderer.SetText(new String(new char[] { THAI_WORD[i], ' ', ' ', ' ' }));
                    textRenderer.SetSpecialScriptsWordBreakPoints(new List <int>(JavaUtil.ArraysAsList(4)));
                }
                else
                {
                    textRenderer.SetText(new String(new char[] { THAI_WORD[i] }));
                    textRenderer.SetSpecialScriptsWordBreakPoints(new List <int>(JavaUtil.ArraysAsList(-1)));
                }
                lineRenderer.AddChild(textRenderer);
                LayoutArea layoutArea = new LayoutArea(1, new Rectangle(0, 0, i * 100, 100));
                if (i == THAI_WORD.Length - 1)
                {
                    textRenderer.occupiedArea = layoutArea;
                    TextRenderer[] split = textRenderer.Split(1);
                    specialScriptLayoutResults.Put(i, new LayoutResult(LayoutResult.PARTIAL, layoutArea, split[0], split[1]));
                }
                else
                {
                    specialScriptLayoutResults.Put(i, new LayoutResult(LayoutResult.FULL, layoutArea, null, null));
                }
            }
            LineRenderer.LastFittingChildRendererData lastFittingChildRendererData = lineRenderer.GetIndexAndLayoutResultOfTheLastRendererToRemainOnTheLine
                                                                                         (THAI_WORD.Length - 1, specialScriptLayoutResults, false, new List <IRenderer>());
            NUnit.Framework.Assert.AreEqual(THAI_WORD.Length - 1, lastFittingChildRendererData.childIndex);
            NUnit.Framework.Assert.AreEqual(specialScriptLayoutResults.Get(THAI_WORD.Length - 1), lastFittingChildRendererData
                                            .childLayoutResult);
        }
        public virtual void OneThaiWordSplitAcrossMultipleRenderersGetIndexAndLayoutResult()
        {
            PdfDocument  pdfDocument  = new PdfDocument(new PdfWriter(new MemoryStream()));
            Document     document     = new Document(pdfDocument);
            LineRenderer lineRenderer = new LineRenderer();

            lineRenderer.SetParent(document.GetRenderer());
            String  twoWords = THAI_WORD + "\u0E14\u0E35";
            PdfFont font     = PdfFontFactory.CreateFont(THAI_FONT, PdfEncodings.IDENTITY_H);
            IDictionary <int, LayoutResult> specialScriptLayoutResults = new Dictionary <int, LayoutResult>();

            for (int i = 0; i < twoWords.Length; i++)
            {
                TextRenderer textRenderer = new TextRenderer(new Text(""));
                textRenderer.SetProperty(Property.FONT, font);
                textRenderer.SetText(new String(new char[] { twoWords[i] }));
                if (i == THAI_WORD.Length - 1 || i == twoWords.Length - 1)
                {
                    textRenderer.SetSpecialScriptsWordBreakPoints(new List <int>(JavaUtil.ArraysAsList(1)));
                }
                else
                {
                    textRenderer.SetSpecialScriptsWordBreakPoints(new List <int>(JavaUtil.ArraysAsList(-1)));
                }
                lineRenderer.AddChild(textRenderer);
                LayoutArea layoutArea = new LayoutArea(1, new Rectangle(0, 0, i * 100, 100));
                if (i == twoWords.Length - 1)
                {
                    specialScriptLayoutResults.Put(i, new LayoutResult(LayoutResult.NOTHING, layoutArea, null, null));
                }
                else
                {
                    specialScriptLayoutResults.Put(i, new LayoutResult(LayoutResult.FULL, layoutArea, null, null));
                }
            }
            LineRenderer.LastFittingChildRendererData lastFittingChildRendererData = lineRenderer.GetIndexAndLayoutResultOfTheLastRendererToRemainOnTheLine
                                                                                         (THAI_WORD.Length + 1, specialScriptLayoutResults, false, new List <IRenderer>());
            NUnit.Framework.Assert.AreEqual(5, lastFittingChildRendererData.childIndex);
            NUnit.Framework.Assert.AreEqual(LayoutResult.NOTHING, lastFittingChildRendererData.childLayoutResult.GetStatus
                                                ());
            NUnit.Framework.Assert.IsNull(lastFittingChildRendererData.childLayoutResult.GetOccupiedArea());
        }