I create images using PIL, which contain many precisely arranged text strings. My first attempt was to convert the pixel fonts to a writable format, as described here . For example, I download the Silksreen font and convert it:
otf2bdf -p 8pt -o fonts/slkscr.bdf fonts/slkscr.ttf pilfont.py fonts/slkscr.bdf
Then I can use the font in PIL like this:
import Image, ImageDraw, os, sys, ImageFont im = Image.new("RGB", (40,10)) draw = ImageDraw.Draw(im) fn = ImageFont.load('fonts/slkscr.pil') draw.text((0,0), "Hello", font=fn) del draw
However, the resulting image (
) does not reflect what the font should look like .
What procedure should I use to convert and use pixel fonts so that they appear as intended?
Thanks in advance.
python imaging
Vince
source share