CFFI API

pangocffi’s API is made of a number of wrapper classes that provide a more Pythonic interface for various pango objects. Functions that take a pointer as their first argument become methods.

In order to use other C libraries that integrate with pango, or if pangocffi’s API is not sufficient, you can access pango’s lower level C pointers and API through CFFI.

Module-level objects

pangocffi.ffi

A cffi.FFI instance with all of the pango C API declared.

pangocffi.pango

The libpango library, pre-loaded with ffi.dlopen(). All pango functions are accessible as attributes of this object:

from pangocffi import Context, Layout
from pangocffi import pango as pango_c

context = Context()
layout = Layout(context)

pango_c.pango_renderer_draw_layout(..., layout.pointer, 0, 0)

See the pango reference manual for details.