forked from ttrftech/NanoVNA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFont8x8.c
196 lines (185 loc) · 8.78 KB
/
Font8x8.c
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#include <stdint.h>
const uint8_t x8x8_bits[][8]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* nul */
{0x00,0x20,0x50,0x50,0x88,0x88,0xFC,0x00}, /* delta */
{0x00,0x50,0xa0,0x50,0xa0,0x50,0xa0,0x00}, /* multiline marker */
{0x00,0x20,0x40,0xF8,0xF8,0x40,0x20,0x00}, /* left arrow */
{0x00,0x20,0x10,0xF8,0xF8,0x10,0x20,0x00}, /* right arrow */
{0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x00}, /* pi */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0x06}, /* micro */
{0x7C,0xC6,0xC6,0xC6,0x6C,0x6C,0xEE,0x00}, /* omega */
{0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00}, /* degree */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x20 ' ' */
{0x60,0xF0,0xF0,0x60,0x60,0x00,0x60,0x00}, /* 0x21 '!' */
{0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00}, /* 0x22 '"' */
{0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00}, /* 0x23 '#' */
{0x30,0x7C,0xC0,0x78,0x0C,0xF8,0x30,0x00}, /* 0x24 '$' */
{0x00,0xC6,0xCC,0x18,0x30,0x66,0xC6,0x00}, /* 0x25 '%' */
{0x38,0x6C,0x38,0x76,0xDC,0xCC,0x76,0x00}, /* 0x26 '&' */
{0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00}, /* 0x27 ''' */
{0x30,0x60,0xC0,0xC0,0xC0,0x60,0x30,0x00}, /* 0x28 '(' */
{0xC0,0x60,0x30,0x30,0x30,0x60,0xC0,0x00}, /* 0x29 ')' */
{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00}, /* 0x2A '*' */
{0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00}, /* 0x2B '+' */
{0x00,0x00,0x00,0x00,0x00,0xE0,0x60,0xC0}, /* 0x2C ',' */
{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00}, /* 0x2D '-' */
{0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x00}, /* 0x2E '.' */
{0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00}, /* 0x2F '/' */
{0x78,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x00}, /* 0x30 '0' */
{0x30,0xF0,0x30,0x30,0x30,0x30,0xFC,0x00}, /* 0x31 '1' */
{0x78,0xCC,0x0C,0x38,0x60,0xCC,0xFC,0x00}, /* 0x32 '2' */
{0x78,0xCC,0x0C,0x38,0x0C,0xCC,0x78,0x00}, /* 0x33 '3' */
{0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x00}, /* 0x34 '4' */
{0xFC,0xC0,0xF8,0x0C,0x0C,0xCC,0x78,0x00}, /* 0x35 '5' */
{0x38,0x60,0xC0,0xF8,0xCC,0xCC,0x78,0x00}, /* 0x36 '6' */
{0xFC,0xCC,0x0C,0x18,0x30,0x60,0x60,0x00}, /* 0x37 '7' */
{0x78,0xCC,0xCC,0x78,0xCC,0xCC,0x78,0x00}, /* 0x38 '8' */
{0x78,0xCC,0xCC,0x7C,0x0C,0x18,0x70,0x00}, /* 0x39 '9' */
{0x00,0x00,0xC0,0xC0,0x00,0xC0,0xC0,0x00}, /* 0x3A ':' */
{0x00,0x00,0x60,0x60,0x00,0xE0,0x60,0xC0}, /* 0x3B ';' */
{0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00}, /* 0x3C '<' */
{0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00}, /* 0x3D '=' */
{0xC0,0x60,0x30,0x18,0x30,0x60,0xC0,0x00}, /* 0x3E '>' */
{0x78,0xCC,0x0C,0x18,0x30,0x00,0x30,0x00}, /* 0x3F '?' */
{0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0x78,0x00}, /* 0x40 '@' */
{0x30,0x78,0xCC,0xCC,0xFC,0xCC,0xCC,0x00}, /* 0x41 'A' */
{0xFC,0x66,0x66,0x7C,0x66,0x66,0xFC,0x00}, /* 0x42 'B' */
{0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00}, /* 0x43 'C' */
{0xFC,0x6C,0x66,0x66,0x66,0x6C,0xFC,0x00}, /* 0x44 'D' */
{0xFE,0x62,0x68,0x78,0x68,0x62,0xFE,0x00}, /* 0x45 'E' */
{0xFE,0x62,0x68,0x78,0x68,0x60,0xF0,0x00}, /* 0x46 'F' */
{0x3C,0x66,0xC0,0xC0,0xCE,0x66,0x3E,0x00}, /* 0x47 'G' */
{0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00}, /* 0x48 'H' */
{0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x49 'I' */
{0x1E,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00}, /* 0x4A 'J' */
{0xE6,0x66,0x6C,0x78,0x6C,0x66,0xE6,0x00}, /* 0x4B 'K' */
{0xF0,0x60,0x60,0x60,0x62,0x66,0xFE,0x00}, /* 0x4C 'L' */
{0xC6,0xEE,0xFE,0xD6,0xC6,0xC6,0xC6,0x00}, /* 0x4D 'M' */
{0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0xC6,0x00}, /* 0x4E 'N' */
{0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x38,0x00}, /* 0x4F 'O' */
{0xFC,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}, /* 0x50 'P' */
{0x78,0xCC,0xCC,0xCC,0xDC,0x78,0x1C,0x00}, /* 0x51 'Q' */
{0xFC,0x66,0x66,0x7C,0x78,0x6C,0xE6,0x00}, /* 0x52 'R' */
{0x78,0xCC,0xE0,0x38,0x1C,0xCC,0x78,0x00}, /* 0x53 'S' */
{0xFC,0xB4,0x30,0x30,0x30,0x30,0x78,0x00}, /* 0x54 'T' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFC,0x00}, /* 0x55 'U' */
{0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x56 'V' */
{0xC6,0xC6,0xC6,0xD6,0xFE,0xEE,0xC6,0x00}, /* 0x57 'W' */
{0xC6,0xC6,0x6C,0x38,0x6C,0xC6,0xC6,0x00}, /* 0x58 'X' */
{0xCC,0xCC,0xCC,0x78,0x30,0x30,0x78,0x00}, /* 0x59 'Y' */
{0xFE,0xCC,0x98,0x30,0x62,0xC6,0xFE,0x00}, /* 0x5A 'Z' */
{0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xF0,0x00}, /* 0x5B '[' */
{0xC0,0x60,0x30,0x18,0x0C,0x06,0x02,0x00}, /* 0x5C '\' */
{0xF0,0x30,0x30,0x30,0x30,0x30,0xF0,0x00}, /* 0x5D ']' */
{0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00}, /* 0x5E '^' */
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF}, /* 0x5F '_' */
{0xC0,0xC0,0x60,0x00,0x00,0x00,0x00,0x00}, /* 0x60 '`' */
{0x00,0x00,0x78,0x0C,0x7C,0xCC,0x76,0x00}, /* 0x61 'a' */
{0xE0,0x60,0x7C,0x66,0x66,0x66,0xBC,0x00}, /* 0x62 'b' */
{0x00,0x00,0x78,0xCC,0xC0,0xCC,0x78,0x00}, /* 0x63 'c' */
{0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0x76,0x00}, /* 0x64 'd' */
{0x00,0x00,0x78,0xCC,0xFC,0xC0,0x78,0x00}, /* 0x65 'e' */
{0x38,0x6C,0x60,0xF0,0x60,0x60,0xF0,0x00}, /* 0x66 'f' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x67 'g' */
{0xE0,0x60,0x6C,0x76,0x66,0x66,0xE6,0x00}, /* 0x68 'h' */
{0x60,0x00,0xE0,0x60,0x60,0x60,0xF0,0x00}, /* 0x69 'i' */
{0x18,0x00,0x78,0x18,0x18,0x18,0xD8,0x70}, /* 0x6A 'j' */
{0xE0,0x60,0x66,0x6C,0x78,0x6C,0xE6,0x00}, /* 0x6B 'k' */
{0xE0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00}, /* 0x6C 'l' */
{0x00,0x00,0xEC,0xFE,0xD6,0xC6,0xC6,0x00}, /* 0x6D 'm' */
{0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0x00}, /* 0x6E 'n' */
{0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x00}, /* 0x6F 'o' */
{0x00,0x00,0xDC,0x66,0x66,0x7C,0x60,0xF0}, /* 0x70 'p' */
{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0x1E}, /* 0x71 'q' */
{0x00,0x00,0xD8,0x6C,0x6C,0x60,0xF0,0x00}, /* 0x72 'r' */
{0x00,0x00,0x7C,0xC0,0x78,0x0C,0xF8,0x00}, /* 0x73 's' */
{0x20,0x60,0xF8,0x60,0x60,0x68,0x30,0x00}, /* 0x74 't' */
{0x00,0x00,0xCC,0xCC,0xCC,0xCC,0x76,0x00}, /* 0x75 'u' */
{0x00,0x00,0xCC,0xCC,0xCC,0x78,0x30,0x00}, /* 0x76 'v' */
{0x00,0x00,0xC6,0xC6,0xD6,0xFE,0x6C,0x00}, /* 0x77 'w' */
{0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00}, /* 0x78 'x' */
{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0xF8}, /* 0x79 'y' */
{0x00,0x00,0xFC,0x98,0x30,0x64,0xFC,0x00}, /* 0x7A 'z' */
{0x1C,0x30,0x30,0xE0,0x30,0x30,0x1C,0x00}, /* 0x7B '{' */
{0xC0,0xC0,0xC0,0x00,0xC0,0xC0,0xC0,0x00}, /* 0x7C '|' */
{0xE0,0x30,0x30,0x1C,0x30,0x30,0xE0,0x00}, /* 0x7D '}' */
{0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00}, /* 0x7E '~' */
{0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00}, /* 0x7F '' */
};
static const uint8_t x8x8_len[] = {
1 /* nul */ | 6<<4, /* delta */
5 /* multil. */ | 6<<4, /* left */
6 /* right */ | 8<<4, /* pi */
8 /* micro */ | 8<<4, /* omega */
6 /* degree */ | 4<<4, /* 0x20 ' ' */
5 /* 0x21 '!' */ | 6<<4, /* 0x22 '"' */
8 /* 0x23 '#' */ | 7<<4, /* 0x24 '$' */
8 /* 0x25 '%' */ | 8<<4, /* 0x26 '&' */
4 /* 0x27 ''' */ | 5<<4, /* 0x28 '(' */
5 /* 0x29 ')' */ | 9<<4, /* 0x2A '*' */
7 /* 0x2B '+' */ | 4<<4, /* 0x2C ',' */
7 /* 0x2D '-' */ | 3<<4, /* 0x2E '.' */
8 /* 0x2F '/' */ | 7<<4, /* 0x30 '0' */
7 /* 0x31 '1' */ | 7<<4, /* 0x32 '2' */
7 /* 0x33 '3' */ | 8<<4, /* 0x34 '4' */
7 /* 0x35 '5' */ | 7<<4, /* 0x36 '6' */
7 /* 0x37 '7' */ | 7<<4, /* 0x38 '8' */
7 /* 0x39 '9' */ | 3<<4, /* 0x3A ':' */
4 /* 0x3B ';' */ | 6<<4, /* 0x3C '<' */
7 /* 0x3D '=' */ | 6<<4, /* 0x3E '>' */
7 /* 0x3F '?' */ | 8<<4, /* 0x40 '@' */
7 /* 0x41 'A' */ | 8<<4, /* 0x42 'B' */
8 /* 0x43 'C' */ | 8<<4, /* 0x44 'D' */
8 /* 0x45 'E' */ | 8<<4, /* 0x46 'F' */
8 /* 0x47 'G' */ | 7<<4, /* 0x48 'H' */
5 /* 0x49 'I' */ | 8<<4, /* 0x4A 'J' */
8 /* 0x4B 'K' */ | 8<<4, /* 0x4C 'L' */
8 /* 0x4D 'M' */ | 8<<4, /* 0x4E 'N' */
8 /* 0x4F 'O' */ | 8<<4, /* 0x50 'P' */
7 /* 0x51 'Q' */ | 8<<4, /* 0x52 'R' */
7 /* 0x53 'S' */ | 7<<4, /* 0x54 'T' */
7 /* 0x55 'U' */ | 7<<4, /* 0x56 'V' */
8 /* 0x57 'W' */ | 8<<4, /* 0x58 'X' */
7 /* 0x59 'Y' */ | 8<<4, /* 0x5A 'Z' */
5 /* 0x5B '[' */ | 8<<4, /* 0x5C '\' */
5 /* 0x5D ']' */ | 8<<4, /* 0x5E '^' */
9 /* 0x5F '_' */ | 4<<4, /* 0x60 '`' */
8 /* 0x61 'a' */ | 8<<4, /* 0x62 'b' */
7 /* 0x63 'c' */ | 8<<4, /* 0x64 'd' */
7 /* 0x65 'e' */ | 7<<4, /* 0x66 'f' */
8 /* 0x67 'g' */ | 8<<4, /* 0x68 'h' */
5 /* 0x69 'i' */ | 6<<4, /* 0x6A 'j' */
8 /* 0x6B 'k' */ | 5<<4, /* 0x6C 'l' */
8 /* 0x6D 'm' */ | 7<<4, /* 0x6E 'n' */
7 /* 0x6F 'o' */ | 8<<4, /* 0x70 'p' */
8 /* 0x71 'q' */ | 7<<4, /* 0x72 'r' */
7 /* 0x73 's' */ | 6<<4, /* 0x74 't' */
8 /* 0x75 'u' */ | 7<<4, /* 0x76 'v' */
8 /* 0x77 'w' */ | 8<<4, /* 0x78 'x' */
7 /* 0x79 'y' */ | 7<<4, /* 0x7A 'z' */
7 /* 0x7B '{' */ | 3<<4, /* 0x7C '|' */
7 /* 0x7D '}' */ | 8<<4, /* 0x7E '~' */
8 /* 0x7F '' */ | 0<<4
};
uint8_t x8x8_map_char_table(uint8_t ch)
{
if ( ch > 0x7f )
{
/* limit to largest character */
ch = 0x7f - 32 + 9;
}
else if ( ch >= 32 )
{
/* normal character */
ch = ch - 32 + 9;
}
else
{
/* special character */
}
return ch;
}
uint8_t x8x8_get_len(uint8_t ch)
{
return (x8x8_len[ch/2] >> 4*(ch%2) ) & 0x0f;
}