From 96e29061a298cc2be233c1b324e5ea04c88b3e1c Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Tue, 24 Dec 2019 17:28:13 +0100 Subject: [PATCH] font: added conversion verification program --- font/verify.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 font/verify.c diff --git a/font/verify.c b/font/verify.c new file mode 100644 index 0000000..287ae57 --- /dev/null +++ b/font/verify.c @@ -0,0 +1,45 @@ +#include + +#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++; + } +}