Cross platform TTF font render from Python [was: Load TTF from pycairo under Windows]

Laszlo Nagy gandalf at
Fri Sep 18 15:20:15 CEST 2009

> .......
> the reportlab graphics renderPM(_renderPM) module does most things 
> with T1 and TTF and works linux/win32. We use freetype2 internally to 
> extract the curves from ttf and then draw them with libart_lgpl which 
> does anti-aliasing.
I just tried reportlab and RenderPM. I got the same error others got: it 
looks impossible to use it for creating raster images. Details here:

> I think something similar could be done directly with PIL and the 
> antigrain extension.
PIL would be ideal because it is lightweight and works on Windows and 
Linux too. But it is buggy. It doesn't render some east european 
(iso8859-2) characters, which we deperately need. Some TTF fonts are 
rendered incorrecly in PIL. Simply it doesn't work.
> I'm surprised when you say that libfreetype isn't available on 
> windows. It's a fairly hard road, but it can be travelled; certainly 
> we built the parts of freetype that we needed into our extension. That 
> required only a static library from freetype. I haven't needed to do 
> this on windows since 2.1.5 so perhaps it's harder now.
I'll try anything that might work. In fact I have already seen articles 
about windows + libfreetype on the internet, but I could not find 
statically linked libraries built against Python 2.6. If you could send 
me a few hints where to start, I would greatly appreciate it. The only 
one requirement that I do not want to start writting C code and glue 
together libraries by hand. Not because I'm lazy but because I would 
like to have something that can be installed easily on new windows 
systems, and have no dependency problems "out of the box".

Thank you for your efforts.


More information about the Python-list mailing list