[cairo] solutions for display text with Asian fonts
psychon at znc.in
Mon Jun 4 01:25:48 PDT 2012
On 04.06.2012 09:57, Jihe Wei wrote:
> When we try to show text with multi-language,
> like Asian fonts(Chinese, Japanese and Korean).
> But can't display them except some squares.
> says "The toy font API that’s present in Cairo can be ignored,
> as it does not support international text and is there only for convenience
> for smaller projects."
> so what's your opinion?
So let's first make it clear what said toy font API is:
cairo_show_text() and cairo_select_font_face()
What should applications use instead? The docs point at cairo_show_glyphs() /
cairo_show_text_glyphs() and font-backend specific functions like e.g.
However, for these APIs, you are rendering glyphs instead of a text. Converting
your text into glyphs is something that cairo does not do for you (unless you
use the toy text API). If you want a solution that should work everywhere, you
should take a look at Pango. With PangoCairo, you can make Pango draw to a
cairo_t and thus continue using cairo. Pango will convert your text to glyphs
and use the non-toy API for doing its job.
Hopefully this helped.
More information about the cairo