Re: Using the low-level API from Python / Please advise for WeasyPrint



Le 05/10/2012 16:18, Simon Sapin a écrit :
I think that the way forward is to switch to the low-level API. Could
some introspection data be added to make it available from Python? Or
should we write C and skip PyGObject? What about HarfBuzz, how is it
relevant for this use case?

I found the answer. It’s CFFI.

https://cffi.readthedocs.org/

Using Pango with CFFI:
https://github.com/Kozea/WeasyPrint/blob/4f9f486ef/weasyprint/text.py

Now I can use PangoAttribute objects (which is much saner than generating markup) even though the relevant APIs do not have usable introspection data.


See also cairocffi: http://packages.python.org/cairocffi/

Cheers,
--
Simon Sapin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]