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

Robin Becker robin at reportlab.com
Fri Sep 18 09:50:14 EDT 2009


Laszlo Nagy wrote:
> 
>> .......
  > looks impossible to use it for creating raster images. Details here:
> 
> http://osdir.com/ml/python.reportlab.user/2005-06/msg00015.html

OK your error occurs because we need to set up the renderPM canvas with an 
initial font (for compatibility with the PDF canvas). You can down load a zip 
file containing suitable files from http://www.reportlab.org/ftp/pfbfer.zip.

Just unzip the pfb/afm files into reportlab/fonts and stuff should work there after.

> 
>.........
>> 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.
> 
> Laszlo
> 
> 

I could send you the statically linked library that I use, but it's a 
relocatable static library ie you need to combine it with some other extension. 
I'm using it to combine with the _renderPM.c file to create a standalone pyd. I 
suspect that's not what you want.
-- 
Robin Becker



More information about the Python-list mailing list