Exemplo n.º 1
0
        public virtual String ToUnicodeString(int start, int end)
        {
            ActualTextIterator iter = new ActualTextIterator(this, start, end);
            StringBuilder      str  = new StringBuilder();

            while (iter.HasNext())
            {
                GlyphLine.GlyphLinePart part = iter.Next();
                if (part.actualText != null)
                {
                    str.Append(part.actualText);
                }
                else
                {
                    for (int i = part.start; i < part.end; i++)
                    {
                        if (glyphs[i].GetChars() != null)
                        {
                            str.Append(glyphs[i].GetChars());
                        }
                        else
                        {
                            if (glyphs[i].HasValidUnicode())
                            {
                                str.Append(TextUtil.ConvertFromUtf32((int)glyphs[i].GetUnicode()));
                            }
                        }
                    }
                }
            }
            return(str.ToString());
        }
        public virtual void TestActualTestParts()
        {
            Glyph     glyph     = new Glyph(200, 200, '\u002d');
            GlyphLine glyphLine = new GlyphLine(JavaUtil.ArraysAsList(glyph));

            glyphLine.SetActualText(0, 1, "\u002d");
            ActualTextIterator actualTextIterator = new ActualTextIterator(glyphLine);

            GlyphLine.GlyphLinePart part = actualTextIterator.Next();
            // When actual text is the same as the result by text extraction, we should omit redundant actual text in the content stream
            NUnit.Framework.Assert.IsNull(part.actualText);
        }