回复: 回复: How to show chine se text using cairo
"快乐2013" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
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"<[email protected]>; 发送时间: 2013年5月6日(星期一) 晚上9:37 收件人: "cairo"<[email protected]>; 主题: 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_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); > 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 Hi, 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 string. http://cairographics.org/manual/cairo-text.html#cairo-show-text But this is a the "toy" text API, you might get better results with Pango. Cheers, -- Simon Sapin -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo