-
Notifications
You must be signed in to change notification settings - Fork 0
/
font-to-rows.py
111 lines (110 loc) · 2.93 KB
/
font-to-rows.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
font = [
[0x00, 0x00, 0x00], # [space]
[0x00, 0x3A, 0x00], # !
[0x30, 0x00, 0x30], # "
[0x3E, 0x14, 0x3E], # #
[0x0A, 0x3F, 0x14], # $
[0x26, 0x08, 0x32], # %
[0x14, 0x2A, 0x16], # &
[0x00, 0x30, 0x00], # '
[0x00, 0x1C, 0x22], # (
[0x22, 0x1C, 0x00], # )
[0x28, 0x10, 0x28], # *
[0x08, 0x1C, 0x08], # +
[0x02, 0x04, 0x00], # ,
[0x08, 0x08, 0x08], # -
[0x00, 0x02, 0x00], # .
[0x06, 0x08, 0x30], # /
[0x1e, 0x22, 0x3c], # 0
[0x10, 0x3e, 0x00], # 1
[0x26, 0x2a, 0x12], # 2
[0x22, 0x2a, 0x14], # 3
[0x38, 0x08, 0x3e], # 4
[0x3a, 0x2a, 0x24], # 5
[0x1c, 0x2a, 0x2e], # 6
[0x26, 0x28, 0x30], # 7
[0x3e, 0x2a, 0x3e], # 8
[0x3a, 0x2a, 0x3c], # 9
[0x00, 0x14, 0x00], # :
[0x02, 0x14, 0x00], # ;
[0x08, 0x14, 0x22], # <
[0x14, 0x14, 0x14], # =
[0x22, 0x14, 0x08], # >
[0x20, 0x2a, 0x30], # ?
[0x1c, 0x22, 0x1a], # @
[0x1e, 0x28, 0x1e], # a
[0x3e, 0x2a, 0x14], # b
[0x1c, 0x22, 0x22], # c
[0x3e, 0x22, 0x1c], # d
[0x3e, 0x2a, 0x2a], # e
[0x3e, 0x28, 0x28], # f
[0x1c, 0x2a, 0x2e], # g
[0x3e, 0x08, 0x3e], # h
[0x22, 0x3e, 0x22], # i
[0x04, 0x22, 0x3c], # j
[0x3e, 0x08, 0x36], # k
[0x3e, 0x02, 0x02], # l
[0x3e, 0x10, 0x3e], # m
[0x3e, 0x20, 0x1e], # n
[0x1c, 0x22, 0x1c], # o
[0x3e, 0x28, 0x10], # p
[0x1c, 0x22, 0x1e], # q
[0x3e, 0x28, 0x16], # r
[0x12, 0x2a, 0x24], # s
[0x20, 0x3e, 0x20], # t
[0x3c, 0x02, 0x3e], # u
[0x3c, 0x02, 0x3c], # v
[0x3e, 0x04, 0x3e], # w
[0x36, 0x08, 0x36], # x
[0x30, 0x0e, 0x30], # y
[0x26, 0x2a, 0x32], # z
[0x00, 0x3e, 0x22], # [
[0x30, 0x08, 0x06], # \
[0x22, 0x3e, 0x00], # ]
[0x10, 0x20, 0x10], # ^
[0x02, 0x02, 0x02], # _
[0x20, 0x10, 0x00], # `
[0x0c, 0x12, 0x1e], # a
[0x3e, 0x12, 0x0c], # b
[0x0c, 0x12, 0x12], # c
[0x0c, 0x12, 0x3e], # d
[0x0c, 0x16, 0x1a], # e
[0x08, 0x1e, 0x28], # f
[0x0c, 0x15, 0x1e], # g
[0x3e, 0x08, 0x06], # h
[0x00, 0x2c, 0x02], # i
[0x01, 0x2e, 0x00], # j
[0x3e, 0x08, 0x16], # k
[0x00, 0x3c, 0x02], # l
[0x1e, 0x08, 0x1e], # m
[0x1e, 0x10, 0x0e], # n
[0x0c, 0x12, 0x0c], # o
[0x1f, 0x12, 0x0c], # p
[0x0c, 0x12, 0x1f], # q
[0x1e, 0x08, 0x10], # r
[0x0a, 0x1a, 0x14], # s
[0x10, 0x3c, 0x12], # t
[0x1c, 0x02, 0x1e], # u
[0x1c, 0x02, 0x1c], # v
[0x1e, 0x04, 0x1e], # w
[0x12, 0x0c, 0x12], # x
[0x18, 0x05, 0x1e], # y
[0x12, 0x16, 0x1a], # z
[0x08, 0x36, 0x22], # {
[0x00, 0x3e, 0x00], # |
[0x22, 0x36, 0x08], # }
[0x08, 0x0c, 0x04], # ~
]
for i,char in enumerate(font):
rows = []
print('db ', end='')
for row in range(0,6):
binary = 0b0000
if char[0] << row & 0b100000:
binary = binary | 0b1000
if char[1] << row & 0b100000:
binary = binary | 0b0100
if char[2] << row & 0b100000:
binary = binary | 0b0010
print("0x{:02X}, ".format(binary), end='')
print(end="\n")