def c8x8(rom, bdf, *iters): with open(bdf, 'rb') as fp: font = reader.read_bdf(fp) cp = font.codepoints() for c in itertools.chain(*iters): if c in cp: b = common.to_data(font[c], 8, 8) o = 249856 + c * 8 rom[o:(o + len(b))] = b
def singlebyte(rom, bdf, *iters): with open(bdf, 'rb') as fp: font = reader.read_bdf(fp) cp = font.codepoints() for c in itertools.chain(*iters): if c in cp: b = common.to_data(font[c], 8, 16) o = 251904 + c * 16 rom[o:(o + len(b))] = b
def jisx0208(rom, bdf): with open(bdf, 'rb') as fp: font = reader.read_bdf(fp) cp = font.codepoints() for c1 in range(0x21, 0x7f): for c2 in range(0x21, 0x7f): c = c1 * 256 + c2 i = krom_index(c1, c2) if c in cp and i is not None: b = common.to_data(font[c], 16, 16) o = i * 32 rom[o:(o + len(b))] = b