comparison scripts/fonts_test.py @ 142:bb26c12bb9f6

Added other auxiliary files corruption tests
author boulanni <nicolas_boulanger@hotmail.com>
date Tue, 23 Feb 2010 14:15:47 -0500
parents 36010ff90255
children
comparison
equal deleted inserted replaced
141:3346fcd3818b 142:bb26c12bb9f6
1 #!/usr/bin/python
1 2
2 import random, os 3 import os
3 import ImageFont, ImageDraw, Image 4 import ImageFont, ImageDraw, Image
4 5
5 dir1 = "/data/lisa/data/ift6266h10/allfonts/" 6 dir1 = "/data/lisa/data/ift6266h10/allfonts/"
7 #dir1 = "/Tmp/allfonts/"
6 8
7 img = Image.new("L", (100,100)) 9 img = Image.new("L", (132,132))
8 draw = ImageDraw.Draw(img) 10 draw = ImageDraw.Draw(img)
11 L = [chr(ord('0')+x) for x in range(10)] + [chr(ord('A')+x) for x in range(26)] + [chr(ord('a')+x) for x in range(26)]
9 12
10 for f in os.listdir(dir1): 13 for f in os.listdir(dir1):
11 try: 14 try:
12 font = ImageFont.truetype(dir1+f, 25) 15 font = ImageFont.truetype(dir1+f, 25)
13 textSize = font.getsize("kD9") 16 for l in L:
17 draw.text((60,60), l, font=font, fill="white")
14 except: 18 except:
15 print dir1+f 19 print dir1+f