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, 0, p.DefaultPageSettings.PrintableArea.Width, p.DefaultPageSettings.PrintableArea.Height));
};
try
{
p.Print();
}
catch (Exception ex)
{
throw new Exception("Exception Occured While Printing", ex);
}
}
問題をレンダリングC#シンハラ語のUnicodeフォントで印刷Unicodeフォントに。"Iskoola Pota"はUnicodeのフォントこのコードは動作しますが、私のテキストは<strong>ある「අම්මා」</strong>が、それはそれはのように正しい方法を示して私を助けてください、このよう<strong>අ්මමා」</strong>として表示
の使用
TextRenderer.DrawText
あなたが直接 'str'を使用しようとしたことがありますか?あなたがした場合、結果は何ですか? – FildorUTF8エンコードなし同じ出力අ්මමා –
おそらくこれが役立つ可能性があります:http://stackoverflow.com/q/6198744/982149 – Fildor