user2901745
user2901745

Reputation: 413

PIL fonts showing up as squares

I have a program that is supposed to generate an image with a bunch of random symbols randomly placed around it. When I run it, this is what gets created.enter image description here

The font I'm trying to use is symbol.ttf which I grabbed out of C:\WINDOWS\Fonts

Here's the code I'm using to paste the characters:

font = 'fonts/symbol.ttf'  

t = Image.new("RGBA", (300,300))
draw = ImageDraw.Draw(t)

font = ImageFont.truetype(font, fontsize)

draw.text((70, 70), txt, (0,0,0), font=font)

t = t.rotate(rot)

image.paste(t,box,t)

Upvotes: 1

Views: 844

Answers (1)

Matthew Mullin
Matthew Mullin

Reputation: 179

Try

ImageFont.truetype(font, fontsize, encoding="symb")

Upvotes: 2

Related Questions