[cairo] cairomm - userfonts

Behdad Esfahbod behdad at behdad.org
Sun May 25 21:49:42 PDT 2008

On Sun, 2008-05-25 at 22:36 -0300, Felipe Sanches wrote:
> I started to read the cairomm code today because I am interested in
> coding the userfont cairomm binding but I faced the following problem:
> how do we deal with callbacks when writting a binding? I need to give
> to cairo a callback to a class method since cairo is written in C, how
> would it deal with the instance pointer (this) ?


I'm no binding expert, but I believe the idea is that you can use the
user_data mechanism to attach arbitrary data to cairo objects.  In this
case see cairo_scaled_font_set_user_data.  You would stuff your method
and instance pointers into a struct and hook it to user_data, then
attach a callback that retrieves that user_data and calls the actual

> Juca

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list