[cairo] User font callbacks and user data
kaffeetisch at gmx.de
Sun Oct 26 06:20:16 PDT 2008
> I noticed there were some user-font callbacks added in 1.8:
> I'm trying to implement these in a scripting language but I'm having
> trouble because unlike the other callbacks these do not seem to have a
> "user data" parameter. This is necessary to proxy the C function call
> to a function in the scripting language.
> At first I was thinking I could set a user data on the font face but
> then I realized that might not work because when the callbacks are
> called they are using a scaled font type and not a font face.
I haven't looked into wrapping those myself, but if I understand the
documentation correctly, you can use cairo_font_face_set_user_data() to
install font-face-specific user data. Like a struct that contains all the
information you need to marshal all the callbacks. In your wrapper callbacks,
you can then use cairo_scaled_font_get_font_face() to get the font face on which
you can call cairo_font_face_get_user_data() to get your struct.
More information about the cairo