I'm trying to compile the Aggdraw drawing module for Python 2,7 with Freetype text rendering support in Windows. Problem is, even though I'm doing everything by the book I still get the error message that there is no font renderer:
Traceback (most recent call last):
File "C:\Users\BIGKIMO\Desktop\fdsfdf.py", line 9, in <module>
font = Font('black', r'C:\Windows\Fonts\Georgia.ttf')
IOError: cannot load font (no text renderer)
I've read previous posts about it, so did these steps:
- Downloaded precompiled version of Freetype 2.3.5
- Pointed the FREETYPE_ROOT variable in the setup.py script to the freetype folder path ("C:/.../Desktop/freetype-2.3.5")
- Installed aggdraw by typing
cd path/to/folder/of/setup.py
, and thenpython setup.py install
The setup script seems to accept the freetype location I give it and does not complain about freetype being disabled, so I would've thought that Aggdraw Freetype support got installed.
I've tried the same on a Mac, using the 64-bit version of Aggdraw, compiled Freetype, compiled Aggdraw with link to Freetype, yet still won't let me draw text.
Here is the code I use to test the text rendering, though that shouldnt be the problem:
from PIL import Image
from aggdraw import Draw, Brush, Pen, Font
size = 500, 500
img = Image.new("RGBA", size)
draw = Draw(img)
draw.rectangle((0, 0) + size, Brush((255, 255, 255), opacity=255))
draw.setantialias(True)
font = Font('black', r'C:\Windows\Fonts\Georgia.ttf')
draw.text((100, 100), "hello, world", font)
draw.flush()
img.save("test.png")
What am I doing wrong? Why would it let me compile with a link to Freetype, yet still complain about no font renderer?
Thanks!