X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Ffont2b.c;h=5ce243a8199fe4e113c1280279b05005ea2540b7;hp=6c1af61adabc0aa2b0a035eae695092f8c7636e5;hb=HEAD;hpb=800e17e9826d024a38edb45b59de7953394002d2 diff --git a/betty/font2b.c b/betty/font2b.c index 6c1af61..5ce243a 100644 --- a/betty/font2b.c +++ b/betty/font2b.c @@ -21,6 +21,8 @@ #include #include +typedef unsigned int u32; + // put your font data here! #include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c" @@ -40,7 +42,7 @@ int main(int argc,char **argv) { stat=CHAR; if(argc==2) { - fd=open(argv[1],O_WRONLY); + fd=open(argv[1],O_WRONLY|O_CREAT); if(fd<0) { perror("file open"); return fd; @@ -49,34 +51,33 @@ int main(int argc,char **argv) { } if(stat==CHAR) - printf("const unsigned char default_font[%d]={\n",256*8*2); + printf("const unsigned char default_font[%d]={\n",256*8); for(font=0;font<=0xff;font++) { /* print the font number */ - printf("\t/* %d 0x%02x",font,font); - if((font>0x1f)&(font<0x7f)) - printf(" %c */\n",font); - else - printf(" */\n"); + if(stat==CHAR) { + printf("\t/* %d 0x%02x",font,font); + if((font>0x1f)&(font<0x7f)) + printf(" %c */\n",font); + else + printf(" */\n"); + } /* print the array content of the font */ for(col=0;col<8;col++) { buf=0; for(row=0;row<8;row++) - buf|=(font_data[font*8+row]&(1<<(7-col))); + buf|=(((font_data[font*8+row]>>(7-col))&1)<