Example #1
0
        /// <summary>
        /// Constructs a Phrase with a certain leading, a certain string
        /// and a certain Font.
        /// </summary>
        /// <param name="leading">the leading</param>
        /// <param name="str">a string</param>
        /// <param name="font">a Font</param>
        public Phrase(float leading, string str, Font font) : this(leading) {
            this.font = font;
            if (Font.Family != Font.SYMBOL && Font.Family != Font.ZAPFDINGBATS && Font.BaseFont == null)
            {
                int index;
                while ((index = Greek.index(str)) > -1)
                {
                    if (index > 0)
                    {
                        string firstPart = str.Substring(0, index);

                        /* bugfix [ #461272 ] CODE CHANGE REQUIRED IN Phrase.java
                         *                                 by Arekh Nambiar */
                        base.Add(new Chunk(firstPart, font));
                        str = str.Substring(index);
                    }
                    Font          symbol = new Font(Font.SYMBOL, Font.Size, Font.Style, Font.Color);
                    StringBuilder buf    = new StringBuilder();
                    buf.Append(Greek.getCorrespondingSymbol(str[0]));
                    str = str.Substring(1);
                    while (Greek.index(str) == 0)
                    {
                        buf.Append(Greek.getCorrespondingSymbol(str[0]));
                        str = str.Substring(1);
                    }
                    base.Add(new Chunk(buf.ToString(), symbol));
                }
            }
            if (str.Length != 0)
            {
                base.Add(new Chunk(str, font));
            }
        }
Example #2
0
        /// <summary>
        /// Gets a chunk with a symbol character.
        /// </summary>
        /// <param name="c">the original ASCII-char</param>
        /// <param name="font"></param>
        /// <returns></returns>
        public static Chunk get(char c, Font font)
        {
            char greek = Greek.getCorrespondingSymbol(c);

            if (greek == ' ')
            {
                return(new Chunk(new string(c, 1), font));
            }
            Font   symbol = new Font(Font.SYMBOL, font.Size, font.Style, font.Color);
            string s      = new string(greek, 1);

            return(new Chunk(s, symbol));
        }