def dump_arduino(font): ks = font.keys() ks.sort() print "#include <avr/io.h>" print "#include <avr/pgmspace.h>" print print "static uint16_t font[] PROGMEM = {" for k in [chr(c) for c in range(ord(' '), 127)]: print "\t0b{0:016b}, // {1:s} - {0:04x} - {3:s}".format(font[k], k, font[k], mangle(font[k])) print "};"
def dump_python(font): # broken, needs to escape ' & \ ks = font.keys() ks.sort() print "#!/usr/bin/env python" print print "font = {" for k in [chr(c) for c in range(ord(' '), 127)]: print "\t'{1:s}': 0x{0:04x}, # {0:04x} - 0b{0:016b}".format(font[k], k, font[k], mangle(font[k])) print "}"
def dump_arduino(font): ks = font.keys() ks.sort() print "#include <avr/io.h>" print "#include <avr/pgmspace.h>" print print "static uint16_t font[] PROGMEM = {" for k in [chr(c) for c in range(ord(' '), 127)]: print "\t0b{0:016b}, // {1:s} - {0:04x} - {3:s}".format( font[k], k, font[k], mangle(font[k])) print "};"
def dump_python(font): # broken, needs to escape ' & \ ks = font.keys() ks.sort() print "#!/usr/bin/env python" print print "font = {" for k in [chr(c) for c in range(ord(' '), 127)]: print "\t'{1:s}': 0x{0:04x}, # {0:04x} - 0b{0:016b}".format( font[k], k, font[k], mangle(font[k])) print "}"