[cairo] text with French accents

Carl Worth cworth at cworth.org
Mon Sep 8 14:13:19 PDT 2008


On Sat, 2008-08-23 at 07:27 -0400, Tracy Hill wrote:
> Does cairo support text with French accents such as "é"?
> 
> When I use cairo_text_extents() to measure text, it returns a length
> of 0.  Other text works fine.

cairo_text_extents relates to cairo_show_text, and those are both
limited by working with only a *single* font. So if your font doesn't
include a glyph for 'é' then you'll get no extents and no output.

The fix is to use cairo_glyph_extents and cairo_show_glyphs. It's a lot
more work to use those, and as suggested previously, the best answer is
to use pango. Pango is quite smart about using multiple fonts as
necessary to satisfy all the glyphs of a string, for example.

I hope that helps,

-Carl




More information about the cairo mailing list