[cairo] Freetype to Cairo - newb needs help

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Tue Oct 23 15:02:38 PDT 2007


Behdad Esfahbod wrote:
> On Tue, 2007-10-23 at 15:20 -0400, Behdad Esfahbod wrote:
> > 
> > > # find DLLs
> > > cairo_dll    = ctypes.CDLL("libcairo.so")
> > > freetype_dll = ctypes.CDLL("libfreetype.so")
> > > # this makes pycairo's internals available.
> > > pycairo_dll  = ctypes.PyDLL(cairo._cairo.__file__)
> > 
> > Yep, this is what I was pointed to by pygtk authors too.  I'm going to
> > add this to cairo website.
> 
> Though, doesn't work out of the box for me as recent-enough pycairo only
> exports the init_cairo symbol.  /me goes finding other ways.

Oh. Gentoo does something funny when it builds pycairo (1.4.0); the
resulting _cairo.so exports PycairoFontFace_FromFontFace and a lot of
other useful symbols.

I'd resort to C at this point; pycairo.h provides the wrapper we need
in the Pycairo_CAPI interface. (Of course it's possible to wrap that
struct with  ctypes  and query python for it with
ctypes.pythonapi.PyCObject_Import("cairo", "CAPI"). But it feels
wrong.)

Bertram


More information about the cairo mailing list