private byte[] CreateTextString(string text) { if (pdfFont.PdfFontType == PdfFont.FontType.TrueType) { PdfTrueTypeFont ttf = pdfFont as PdfTrueTypeFont; int i = 0; char[] glyph = new char[text.Length]; for (int k = 0; k < text.Length; ++k) { int[] metrics = ttf.GetMetricsTT(text[k]); if (metrics != null) { glyph[i] = (char)metrics[0]; i++; } } return(System.Text.Encoding.BigEndianUnicode.GetBytes(glyph)); } else { string alter = Utility.TextEncode(text); return(System.Text.Encoding.ASCII.GetBytes(alter)); } }