Commit 3f2d30c8 authored by Michael Murtaugh's avatar Michael Murtaugh

pixel fonts from bdf->pil

parent 907260af
......@@ -120,7 +120,7 @@ if __name__ == "__main__":
ap.add_argument("input", nargs="+")
args = ap.parse_args()
for n in args.input:
with open(font_file_path,'rb') as fp:
p = BdfFontFile.BdfFontFile(fp) #PcfFontFile if you're reading PCF files
with open(n,'rb') as fp:
p = BdfFontFile(fp) #PcfFontFile if you're reading PCF files
# won't overwrite, creates new .pil and .pdm files in same dir
p.save(font_file_path)
p.save(n)
from PIL import Image, ImageDraw, ImageFont
# for s in range(1, 20):
im = Image.new("RGB", (64,32))
# font = ImageFont.truetype("fonts/slkscre.ttf", s)
font = ImageFont.load("fonts/tom-thumb.pil")
draw = ImageDraw.ImageDraw(im)
draw.text((0, 0), "hello world", font=font, fill=(255,255,255))
im.save("fonttest.png")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment