Mercurial > ift6266
annotate scripts/fonts_test.py @ 489:ee9836baade3
merge
author | dumitru@dumitru.mtv.corp.google.com |
---|---|
date | Mon, 31 May 2010 19:07:59 -0700 |
parents | bb26c12bb9f6 |
children |
rev | line source |
---|---|
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
1 #!/usr/bin/python |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
2 |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
3 import os |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
4 import ImageFont, ImageDraw, Image |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
5 |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
6 dir1 = "/data/lisa/data/ift6266h10/allfonts/" |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
7 #dir1 = "/Tmp/allfonts/" |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
8 |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
9 img = Image.new("L", (132,132)) |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
10 draw = ImageDraw.Draw(img) |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
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)] |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
12 |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
13 for f in os.listdir(dir1): |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
14 try: |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
15 font = ImageFont.truetype(dir1+f, 25) |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
16 for l in L: |
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
17 draw.text((60,60), l, font=font, fill="white") |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
18 except: |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
19 print dir1+f |