在C#Sinhala unicode字体渲染问题中打印unicode字体
发布时间:2020-12-16 06:53:11 所属栏目:百科 来源:网络整理
导读:private void button1_Click(object sender,EventArgs e) { string str = "?????"; byte[] utf8Bytes = Encoding.UTF8.GetBytes(str); String productLine = Encoding.UTF8.GetString(utf8Bytes); PrintDocument p = new PrintDocument(); p.PrintPage += de
private void button1_Click(object sender,EventArgs e) { string str = "?????"; byte[] utf8Bytes = Encoding.UTF8.GetBytes(str); String productLine = Encoding.UTF8.GetString(utf8Bytes); PrintDocument p = new PrintDocument(); p.PrintPage += delegate(object sender1,PrintPageEventArgs e1) { e1.Graphics.DrawString(productLine,new Font("Iskoola Pota",18),new SolidBrush(Color.Black),new RectangleF(0,p.DefaultPageSettings.PrintableArea.Width,p.DefaultPageSettings.PrintableArea.Height)); }; try { p.Print(); } catch (Exception ex) { throw new Exception("Exception Occured While Printing",ex); } } 这个代码有效,但我的文字是“?????”,但它以这种方式显示?????“所以请帮助我以正确的方式显示.”Iskoola Pota“是Unicode字体 解决方法
UTF-8不是unicode.在源代码中声明字符串时,这是unicode.在你的情况下,删除短声乐的变音符号在转换过程中会丢失.但更糟糕的事情可能发生,例如,Unicode Conversion in c#
为什么还要通过UTF-8?怎么样简单 e1.Graphics.DrawString(str,... 另外:你检查过你的“School Book”字体是否正常,即可以显示一个无人的m??,例如在Word中使用该字体? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容