[cairo] 回复: 回复: How to show chinese text using cairo

快乐2013 350137278 at qq.com
Mon May 6 06:43:43 PDT 2013

thanks for your advise. but I fail to compile pango on win7.
can freetype do it job?
pango with GTK+ is so torrible on win7. 

------------------ 原始邮件 ------------------
发件人: "Simon Sapin"<simon.sapin at exyr.org>;
发送时间: 2013年5月6日(星期一) 晚上9:37
收件人: "cairo"<cairo at cairographics.org>; 

主题: Re: [cairo] 回复:  How to show chinese text using cairo

Le 06/05/2013 15:13, 快乐2013 a écrit :
> Hi, what I have my code as below:
>     cairo_select_font_face (cr, "Arial Unicode MS",
>     cairo_set_font_size (cr, 32.0);
>     cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
>     cairo_move_to (cr, 10.0, 50.0);
>      cairo_show_text (cr, "Hello, 中国人  "); // this clause cannot work
> I wonder if the following can work at all.
>      // does this clause can work?
>      cairo_show_text (cr, toUtf8("Hello, 中国人  "));
> here toUtf8 is a functioin doing convertion from ansi to utf8


I don’t know what is the character encoding of string literals on your 
system (perhaps just the encoding your editor is saving as), but yes, 
cairo_show_text does support Unicode and expects a NUL-terminated UTF-8 


But this is a the "toy" text API, you might get better results with Pango.

Simon Sapin
cairo mailing list
cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130506/970b0441/attachment.html>

More information about the cairo mailing list