18 lines
424 B
Python
18 lines
424 B
Python
with open("font.ttf", "rb") as f:
|
|
data = f.read()
|
|
|
|
with open("output.txt", "w", encoding="utf-8") as f:
|
|
f.write("unsigned char font_data[] = {\n")
|
|
|
|
for i, byte in enumerate(data):
|
|
if i != len(data) - 1:
|
|
f.write(f"0x{byte:02X}, ")
|
|
else:
|
|
f.write(f"0x{byte:02X}")
|
|
|
|
if (i + 1) % 12 == 0:
|
|
f.write("\n")
|
|
|
|
f.write("\n};")
|
|
|
|
print("已输出到 output.txt") |