dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
encode_font.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
3 # Copyright (C) 2016 dRonin; trivial convert-mcm-to-gcc-array-syntax thingy
4 
5 import sys
6 
7 def main(args):
8  if (len(args) != 2):
9  print("usage: %s fontfile.mcm")
10  print("outputs to stdout")
11  return
12 
13  with open(args[1]) as f:
14  font_data = f.readlines()[1:]
15 
16  print("/* autogenerated from %s */"%(args[1]))
17 
18  # Only carry the useful bits, to not waste memory.
19  for i in range(0, len(font_data), 64):
20  for j in range(0, 54):
21  line = font_data[i+j]
22  print('\t0b' + line.strip() + ',')
23 
24 if __name__ == '__main__':
25  main(sys.argv)
26 
static int print(char **out, const char *format, va_list args)