Revision 182
adding font
split_font.py | ||
---|---|---|
11 | 11 |
|
12 | 12 |
i = 32 |
13 | 13 |
|
14 |
with open("font.h", 'w') as f: |
|
15 |
includes = "" |
|
16 |
lst = "" |
|
14 | 17 |
|
18 |
for j in range(i): |
|
19 |
if lst != "": lst += "," |
|
20 |
lst += "NULL" |
|
15 | 21 |
|
16 |
for h in range(Nh): |
|
17 |
t = int(H/Nh)*h |
|
18 |
b = int(H/Nh)*(h+1) |
|
19 |
for w in range(Nw): |
|
20 |
#l = int((W*w)/Nw) |
|
21 |
#r = int((W*(w+1))/Nw) |
|
22 |
l = 59*w |
|
23 |
r = 59*(w+1) |
|
24 |
im1 = im.crop((l,t,r,b)) |
|
25 |
im1.save("%03d.png"%i) |
|
26 |
os.system("convert %03d.png xpm/%03d.xpm"%(i,i)) |
|
27 |
os.system("rm %03d.png"%i) |
|
28 |
i += 1 |
|
22 |
|
|
23 |
for h in range(Nh): |
|
24 |
t = int(H/Nh)*h |
|
25 |
b = int(H/Nh)*(h+1) |
|
26 |
for w in range(Nw): |
|
27 |
#l = int((W*w)/Nw) |
|
28 |
#r = int((W*(w+1))/Nw) |
|
29 |
l = 59*w |
|
30 |
r = 59*(w+1) |
|
31 |
im1 = im.crop((l,t,r,b)) |
|
32 |
im1.save("png/ascii%03d.png"%i) |
|
33 |
os.system("convert png/ascii%03d.png xpm/ascii%03d.xpm"%(i,i)) |
|
34 |
|
|
35 |
|
|
36 |
includes += '#include "%03d.xpm"\n'%i |
|
37 |
if lst != "": lst += "," |
|
38 |
lst += "%03d_xpm"%i |
|
39 |
|
|
40 |
#DEV |
|
41 |
os.system("rm png/ascii%03d.png"%i) |
|
42 |
|
|
43 |
i += 1 |
|
44 |
|
|
45 |
f.write(includes) |
|
46 |
f.write("xpm_map_t font[] = {"+lst+"}\n") |
Also available in: Unified diff