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