17 lines
487 B
Python
17 lines
487 B
Python
import struct
|
|
with open('unifont_all-15.1.04.hex', 'rt') as f:
|
|
data = f.readlines()
|
|
ret = []
|
|
for w in data:
|
|
a, w = w.strip().split(':')
|
|
e = [int(w[i:i+2], 16) for i in range(0, len(w), 2)]
|
|
b = int(a, 16)
|
|
ret.append(bytes([len(e) // 16]))
|
|
ret.append(bytes([(b >> 16) & 0xFF]))
|
|
ret.append(bytes([(b >> 8) & 0xFF]))
|
|
ret.append(bytes([(b >> 0) & 0xFF]))
|
|
ret.append(bytes(e))
|
|
with open('src/unifont.bin', 'wb') as f:
|
|
for x in ret:
|
|
f.write(x)
|