Esempio n. 1
0
        public override string Encode(string text)
        {
            //	True Type fonts always encode in two-byte codes. The text
            //	string in the PDF is not encoded in Unicode or ASCII or
            //	anything like that. Each two-byte code is a "character
            //	code" that's interpreted by the font and its associated
            //	CMap. Since we use the Identity-H CMap, the codes we
            //	want in the text string are glyph indices into the font.

            StringBuilder sb = new StringBuilder((text.Length * 2) + 6);

            sb.Append("<");
            foreach (char c in text)
            {
                ushort i = _descendant.GetGlyphIndex(c);
                sb.Append(Helpers.Hex(i));
            }
            sb.Append(">");
            return(sb.ToString());
        }