X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fatmel.git;a=blobdiff_plain;f=led_plex%2Fconvert_font.c;fp=led_plex%2Fconvert_font.c;h=33f7897ff0e6549a99395eae468770aaff6e7414;hp=0000000000000000000000000000000000000000;hb=32e3f51bc0f4248019379fe784d38c7fb770f952;hpb=1ae3689334b273952e70ebbde465caa68fd14efd diff --git a/led_plex/convert_font.c b/led_plex/convert_font.c new file mode 100644 index 0000000..33f7897 --- /dev/null +++ b/led_plex/convert_font.c @@ -0,0 +1,60 @@ +/* + * convert_font.c - convert linux console 8x8 font data + * + * author: hackbard@hackdaworld.org + * + * usage: + * + * first you have to adjust this file two times (see comments!) + * + * build: gcc -Wall -o convert_font convert_font.c -I/usr/src/linux/include + * + * ./convert_font > fonts.asm + * + * ONLY 8x8 FONTS SUPPORTED! + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +typedef unsigned int u32; + +// put your font data here! +#include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c" + +int main(int argc,char **argv) { + + unsigned char *font_data; + int font,col,row; + + // adjust the font data pointer here! + font_data=(unsigned char *)fontdata_pearl8x8; + + for(font=0;font<=0x7f;font++) { + + /* print the font number */ + printf("; %d 0x%02x",font,font); + if((font>0x1f)&(font<0x7f)) + printf(" %c\n",font); + else + printf("\n"); + printf(".db "); + + /* print the array content of the font */ + for(col=0;col<8;col++) { + printf("0b"); + for(row=0;row<8;row++) + printf("%c",((font_data[font*8+row]>>(7-col))&1)?'1':'0'); + if(col!=7) printf(", "); + else printf("\n"); + + } + } + + return 0; +}