Project

General

Profile

Statistics
| Revision:

root / proj / font / xpm_to_xpm2.py @ 186

History | View | Annotate | Download (627 Bytes)

1 182 up20180642
import glob
2
import os
3
4
files = [s[4:12] for s in glob.glob("xpm/*.xpm")]
5
files.sort()
6
7
with open("convert.c", 'w') as f:
8
    f.write('#include "xpm_utils.h"\n')
9
    f.write("".join(['#include "%s.xpm"\n'%s for s in files]))
10
    f.write("int main(){\n")
11
    f.write("".join(['    xpm_save_as_xpm2(%s,"xpm2/%s.xpm2");\n'%(s,s) for s in files]))
12
    f.write('    char **r = xpm_load_xpm2("xpm2/ascii065.xpm2");\n')
13
    f.write("    return 0;\n}\n")
14
15
os.system("gcc -I./xpm -I../include convert.c ../src/xpm_utils.c -o convert.app")
16
os.system("./convert.app")
17
18
os.system("rm -f convert.c convert.app")
19
os.system("rm -f xpm/*.xpm")