Using Pango in C#: encoding problem
- From: Isenko Evgeny <isenko po gsinet co jp>
- To: gtk-i18n-list gnome org
- Subject: Using Pango in C#: encoding problem
- Date: Tue, 04 Nov 2008 17:06:49 +0900
Hello!
I'm trying to use Pango in C# (MS Visual Studio), but cannot figure out
how to convert C# strings to the native Pango format (char*) and vice
versa. The non-unicode letters are drawn without problems, but when I
try to put some unicode text, the output is unreadable.
First of all, I confirmed that pango and cairo are working well. For
this I got the sample string with pango_language_get_sample_string and
put it in pango_layout_set_text. It was perfect for any language. But
when I try to convert it to the C# string, I get only unreadable mess.
Below is the code. Would someone tell me where I was wrong?
[DllImport("libpango-1.0-0.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr pango_language_get_sample_string(IntPtr
language);
/* Some code here */
IntPtr samplePointer =
PangoCairo.NativeMethods.pango_language_get_sample_string(myLang);
string outputStr = Marshal.PtrToStringAnsi(samplePointer);
When I use Unicode instead of Ansi, the result becomes even worse...
Thanks for any help.
Evgeny
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]