You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/scripts/GenCFontData.py

18 lines
537 B
Python

font_file = open("Roboto-Regular.ttf", "rb")
raw_bytes = font_file.read()
font_file.close()
cfile = open("robotoFontData.h", "w")
cfile.write("\nnamespace lunarium\n{\n\tconst int RobotoDataSize = ")
cfile.write(str(len(raw_bytes)))
cfile.write(";\n\tconst unsigned char RobotoFontData[] =\n{\n\t")
cfile.write("(unsigned char)" + str(raw_bytes[0]))
for i,b in enumerate(raw_bytes[1:]):
cfile.write(",")
if i % 20 == 0:
cfile.write("\n\t")
cfile.write("(unsigned char)" + str(b))
cfile.write("\n};}")
cfile.close()