mcm_all.py 566 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/python
  2. def convert(in_file, out_file):
  3. '''Compile mcm file to binary'''
  4. with open(in_file) as inp:
  5. content = inp.readlines()
  6. inp.close()
  7. content.pop(0)
  8. out = open(out_file, 'wb')
  9. i = -1
  10. for line in content:
  11. i = i + 1
  12. if i % 64 < 54:
  13. b = int(line, 2)
  14. out.write(bytearray([b]))
  15. out.close()
  16. convert('clarity.mcm', 'font0.bin')
  17. convert('clarity_medium.mcm', 'font1.bin')
  18. convert('bfstyle.mcm', 'font2.bin')
  19. convert('bold.mcm', 'font3.bin')
  20. convert('digital.mcm', 'font4.bin')