Hi Ari,
On Thu, Jul 9, 2009 at 11:09 PM, Aryeh
Gold-Parker<[email protected]> wrote:
>>
>>
>> /usr/lib/python2.6/dist-packages/rdkit/Chem/Draw/aggCanvas.py in
>> addCanvasText(canvas, text, pos, font, color, **kwargs)
>> 72 def addCanvasText(canvas,text,pos,font,color=(0,0,0),**kwargs):
>> 73 color = convertColor(color)
>> ---> 74 font = Font(color,faceMap[font.face],size=font.size)
>> 75 w,h=canvas.textsize(text,font)
>> 76 bw,bh=w*1.1,h*1.1
>>
>> IOError: cannot load font
>
>
> Aggdraw was compiled with freetype support (at least it should have been). I
> have the libraries installed, and pointed aggdraw's setup.py to /usr.
>
> Why would I be getting this problem?
The handling of the fonts in aggCanvas.py is not really optimal (as
you see). At the moment it's hard coded to use
$RDBASE/rdkit/Chem/Draw/FreeSans.ttf; this isn't really what it should
be doing (ideally it would try to figure out the location of the
system ttf directory(ies)), but it does work so long as RDBASE is set
correctly.
What you might try is editing aggCanvas.py and replacing:
faceMap={'sans':os.path.join(RDConfig.RDCodeDir,'Chem','Draw','FreeSans.ttf')}
with:
faceMap={'sans':os.path.join(os.path.dirname(__file__),'FreeSans.ttf')}
-greg