[cairo] Unable to draw non-english text

Isenko Evgeny isenko at po.gsinet.co.jp
Thu Oct 30 19:54:16 PDT 2008


Hi,

I'm using Cairo in C# (MS Visual Studio). It's really great! Drawing to
a bitmap, easy output to PDF, SVG, PNG etc. are just what I want.
However I couldn't succeed to draw any unicode text.

Look at the following test code. It works just fine while the text in
ShowText function is English. When I put some Japanese characters
instead of "Hello!", the drawing stops at this place. I.e. all drawings
before this line are successfull, all drawing after this line (including
the text itself) are blank.


using (Win32Surface imgsrf = new Win32Surface(mygr.GetHdc()))
{
using (Context canv = new Context(imgsrf))
{

/* Some code here */

canv.MoveTo(60, 60);
canv.SelectFontFace("MS Mincho", FontSlant.Normal, FontWeight.Normal);
canv.ShowText("Hello!");

/* Some code here */

}
}

I tryed to use different surface types, different fonts, manualy convert
the string to UTF-8, use bytes array instead of the string, but didn't
succeed.

Thanks for any advice.
__________________
Evgeny Isenko


More information about the cairo mailing list