[cairo] How to show text in chinese with cairo, please?

Dominic Lachowicz domlachowicz at gmail.com
Tue Jun 2 12:19:48 PDT 2009


You can also combine Pango or Uniscribe with Cairo. You can read more
about that @ http://www.cairographics.org/FAQ/#using_pango

2009/6/2 Adib Taraben <taraben.a at st-innovation.com>:
> Hi,
>
> I used cairo to create multi language reports chinese and latin. See
> below the initilisation block.
> I provided the chinese font as ttf file. The target was a pdf this one
> had the font included.
>
> HTH,
>
> Adib.
>
>
>    cairo_surface_t *surface;
>    cairo_status_t   status;
>    cairo_t *cr;
>        FT_Error error;
>        FT_Library library;
>        FT_Face face, face_bold;
>        FT_Face face_ch;
>        cairo_font_face_t *cr_face, *cr_face_bold;
>        cairo_font_face_t *cr_face_ch;
>
>        if(FT_Init_FreeType(&library) != 0)
>        return;
>
>        if(FT_New_Face(library, "arial.ttf", 0, &face) != 0)
>        return;
>        cr_face = cairo_ft_font_face_create_for_ft_face(face, 0);
>        if(FT_New_Face(library, "arialbd.ttf", 0, &face_bold) != 0)
>        return;
>        cr_face_bold = cairo_ft_font_face_create_for_ft_face(face_bold, 0);
>        if(FT_New_Face(library, "simhei.ttf", 0, &face_ch) != 0)
>        return;
>        cr_face_ch = cairo_ft_font_face_create_for_ft_face(face_ch, 0);
>        surface = cairo_pdf_surface_create("C97.pdf", LETTER_WIDTH, LETTER_HEIGHT);
>        cr = cairo_create(surface);
>    status = cairo_status(cr);
>
>
>
> 张伯 wrote:
>> Hello,
>>
>>
>>
>> I use cairo in Visual Studio 2008, and could draw an english text with
>> cairo_select_font_face() successfully.
>>
>> However, when I replaced it with another one in Chinese, there was
>> nothing displayed.
>>
>>
>>
>> What is the reason, please?
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> cairo mailing list
>> cairo at cairographics.org
>> http://lists.cairographics.org/mailman/listinfo/cairo
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



-- 
If I ever get out of here, thought of giving it all away. To a
registered charity. All I need is a pint a day. If I ever get out of
here.


More information about the cairo mailing list