iTextSharp.text.pdf.parser.TextRenderInfo.GetCharacterRenderInfos C# (CSharp) Метод

GetCharacterRenderInfos() публичный Метод

public GetCharacterRenderInfos ( ) : List
Результат List
        public List<TextRenderInfo> GetCharacterRenderInfos()
        {
            List<TextRenderInfo> rslt = new List<TextRenderInfo>(text.Length);

            DocumentFont font = gs.font;
            char[] chars = text.ToCharArray();
            float totalWidth = 0;
            for (int i = 0; i < chars.Length; i++)
            {
                float w = font.GetWidth(chars[i]) / 1000.0f;
                float wordSpacing = chars[i] == 32 ? gs.wordSpacing : 0f;

                TextRenderInfo subInfo = new TextRenderInfo(this, i, totalWidth);
                rslt.Add(subInfo);

                totalWidth += (w * gs.fontSize + gs.characterSpacing + wordSpacing) * gs.horizontalScaling;

            }

            return rslt;
        }

Usage Example

Пример #1
0
            public void RenderText(TextRenderInfo renderInfo)
            {
                List<TextRenderInfo> subs = renderInfo.GetCharacterRenderInfos();
                TextRenderInfo previousCharInfo = subs[0];

                for (int i = 1; i < subs.Count; i++)
                {
                    TextRenderInfo charInfo = subs[i];
                    Vector previousEndPoint = previousCharInfo.GetBaseline().GetEndPoint();
                    Vector currentStartPoint = charInfo.GetBaseline().GetStartPoint();
                    AssertVectorsEqual(previousEndPoint, currentStartPoint, charInfo.GetText());
                    previousCharInfo = charInfo;
                }

            }
All Usage Examples Of iTextSharp.text.pdf.parser.TextRenderInfo::GetCharacterRenderInfos