[cairo] cairomm - userfonts

Murray Cumming murrayc at murrayc.com
Wed Jun 25 04:11:26 PDT 2008


On Mon, 2008-05-26 at 00:49 -0400, Behdad Esfahbod wrote:
> 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) ?
> 
> Hi,
> 
> 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
> callback...

Yes, look for SignalProxy* in .ccg files in gtkmm. For instance,
SignalProxy_Visible_gtk_callback here:
http://svn.gnome.org/viewvc/gtkmm/trunk/gtk/src/treemodelfilter.ccg?view=markup
(SignalProxy is not a great prefix for those really, but nevermind).

I don't know if we had any need for this in cairomm already, but I guess
we do for this new API.

But exactly what callback do you mean. Could you name a specific cairo
function, please?

-- 
murrayc at murrayc.com
www.murrayc.com
www.openismus.com



More information about the cairo mailing list