コード例 #1
0
        private int StreamToUnicode(System.IO.Stream stream)
        {
            Hashtable longTag = ttf.glyphsUsed;
            ArrayList tmp     = new ArrayList();

            foreach (object o in longTag.Values)
            {
                if (o != null)
                {
                    tmp.Add(o);
                }
            }
            Object[] metrics = tmp.ToArray();

            StringBuilder buf = new StringBuilder();

            buf.Append(this.HeadObj);

            buf.Append(String.Format("<</ToUnicode {0}", ttf.GetUnicodeMapDescriptor().HeadR));
            buf.Append(String.Format("/DescendantFonts [{0}]", ttf.GetCidDescriptor().HeadR));
            buf.Append("/Subtype/Type0/Encoding/Identity-H");
            buf.Append(String.Format("/BaseFont/{0}", ttf.Name));

            buf.Append("/Type/Font>>\nendobj\n");


            Byte[] b = ASCIIEncoding.ASCII.GetBytes(buf.ToString());
            stream.Write(b, 0, b.Length);
            return(b.Length);
        }