From 1ddfbba3666a835b59fc79b59aaae367ee93a6ea Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Sat, 22 Dec 2007 02:55:19 +0000 Subject: add new font stuff --- scripts/font_converter.py | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 scripts/font_converter.py (limited to 'scripts/font_converter.py') diff --git a/scripts/font_converter.py b/scripts/font_converter.py new file mode 100644 index 00000000..f2ba0e49 --- /dev/null +++ b/scripts/font_converter.py @@ -0,0 +1,121 @@ +from __future__ import with_statement +import struct +import sys + +def convert(input, output): + with open(input, "r") as in_file: + with open(output, "w") as out_file: + def build_dic(parts): + dic = {} + + for part in parts: + key, value = part.split('=') + + try: + dic[key] = int(value) + except: + dic[key] = value + + return dic + + def get_entry(line): + + parts = line.split() + type = parts[0] + + dic = build_dic(parts[1:]) + + return type, dic + + def write_int16(val): + out_file.write(struct.pack(' " +else: + print "converting..." + convert(sys.argv[1], sys.argv[2]) + print "done!" -- cgit 1.4.1