[cairo] Drawing text

Dominic Lachowicz domlachowicz at gmail.com
Tue Sep 8 04:44:52 PDT 2009

On Tue, Sep 8, 2009 at 6:22 AM, ecir hana<ecir.hana at gmail.com> wrote:
> On Mon, Sep 7, 2009 at 5:45 PM, Dominic Lachowicz<domlachowicz at gmail.com> wrote:
>> You should be able to use Cairo with FreeType loading fonts from
>> files. See the documentation for
>> cairo_ft_font_face_create_for_ft_face().
> Ok, now that I look at this I'm not sure I understood. That function
> accepts "pre-opened FreeType face" - what does it mean? I thought I
> could somehow pass a path to a file font, do I need to first somehow
> open the font via FreeType and then it can be used in Cairo? Perhaps
> are there some examples somewhere?

You need to first open the font via freetype. Check the following URL
for examples.


>> As for Ecir's "dx" question, see cairo_show_glyphs(). You can use
>> cairo_glyph_t's "x" offset to achieve the effect you want.
>  cairo_show_glyphs() accepts cairo_glyph_t which has this "x offset".
> However, the docs say: "Note that the offsets given by x and y are not
> cumulative". Does it mean the positions of glyphs of my text are to be
> positioned absolutelly, i.e. I have to compute every position, like
> "previous_glyhp_position + this_glyph_advance_x +
> this_glyph_my_offset_x"?

That's correct.

More information about the cairo mailing list