font: added conversion verification program
This commit is contained in:
parent
f1e7c46a65
commit
96e29061a2
45
font/verify.c
Normal file
45
font/verify.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "font16_data.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *cfile = fopen("characters16.txt", "r");
|
||||
|
||||
if(!cfile) {
|
||||
printf("Failed to open characters16.txt\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char characters[256];
|
||||
fgets(characters, 256, cfile);
|
||||
fclose(cfile);
|
||||
|
||||
char *c = characters;
|
||||
|
||||
while(*c) {
|
||||
uint8_t idx = font_lut[(uint8_t)(*c)];
|
||||
|
||||
uint16_t char_start = font_pos[idx];
|
||||
uint16_t char_end = char_start + font_width[idx];
|
||||
|
||||
for(uint16_t char_pos = char_start; char_pos < char_end; char_pos++) {
|
||||
|
||||
uint16_t char_data = font_data[char_pos];
|
||||
|
||||
for(uint8_t y = 0; y < font_height; y++) {
|
||||
|
||||
if(char_data & (1 << y)) {
|
||||
printf("#");
|
||||
} else {
|
||||
printf("-");
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
c++;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue