#!/usr/bin/env python3

height = 8
all_chars = list(map(chr, range(128)))

data = {}
min_index = ord(all_chars[0])
max_index = ord(all_chars[-1]) + 1
with open("font-master.txt", "r") as f:
    for c in all_chars:
        data[c] = {}
        data[c]["description"] = f.readline().strip()[1:]
        data[c]["rawbits"] = []
        for row in range(height):
            rawbits = f.readline().strip()
            data[c]["rawbits"].append(rawbits)

print("; Circuitous pixel font")
print("; (c) 2018-2023 by 4am")
print("; license:Open Font License 1.1, see OFL.txt")
print("; This file is automatically generated")
print()
for row in range(height):
    print(f"FontDataRow{row}")
    for c in map(chr, range(min_index, max_index)):
        description = data[c]['description']
        bits = "1" + data[c]["rawbits"][row][::-1]
        print(f"         !byte %{bits} ; {description}")
