4cade/res/notes/oldmakefont.py

16 lines
412 B
Python
Raw Normal View History

2018-12-22 19:55:13 +00:00
#!/usr/bin/env python3
import sys
import os.path
fontfile, srcfile = sys.argv[1:]
with open(fontfile, 'rb') as f:
fontdata = f.read()
assert(len(fontdata) == 1024)
with open(srcfile, 'w') as f:
for row in range(8):
f.write("FontDataRow%s\n" % row)
for i in range(128):
b = fontdata[i*8+(7-row)]
f.write(" !byte $%s\n" % hex(b)[2:].rjust(2, '0').upper())