/* font -- 9/29/87 fnt.bat = cl /AL font.c vimage3 graphlib ******************************************************************/ #include #include #define CHARHGT 25 /* Height of characters in 'font.raw */ FILE *cfp; struct Color { unsigned char r, g, b; }lut[256],lutm[256],lutc[256]; int font[128][25]; char buff[200]; struct board { int row,col,color; }B_Id; unsigned char getpt(); /* returns the value of a pixel */ void encode_font(); /* reads 'font.raw' and creates 'font.hex */ main() { int i,j,k,l,m,n; char string[80]; FILE *fph; for(k=0;k<16;k++) { lut[k].r=k*17; lut[k].g=k*17; lut[k].b=k*17; } i=GetVideoBoardID(); SetVideoMode(0x12,&B_Id); WritePalette(lut); encode_font(); plot_font_h(15,10,10," !\"#$%&'()*+,-./0123456789:;<=>?\\",1,font); plot_font_h(15,10,35," !\"#$%&'()*+,-./0123456789:;<=>?\\",2,font); plot_font_h(15,10,55," !\"#$%&'()*+,-./0123456789:;<=>?\\",3,font); plot_font_h(15,10,100,"abcdefghijklmnopqrstuvwxyz{}|~\\",3,font); plot_font_h(15,10,130,"ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^`",3,font); plot_font_h(15,10,200,"abcdefghijklmnopqrstuvwxyz{}|~\\",2,font); plot_font_h(15,10,230,"ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^`",2,font); plot_font_h(15,10,300,"abcdefghijklm\\",1,font); plot_font_h(15,10,330,"nopqrstuvwxyz\\",1,font); plot_font_h(15,10,360,"ABCDEFGHIJKLM\\",1,font); plot_font_h(15,10,390,"NOPQRSTUVWXYZ[]^`",1,font); plot_font_v(15,350,440,"abcdefghijklmnopqrstuvwxyz\\",3,font); plot_font_v(15,370,440,"ABCDEFGHIJKLMNOPQRSTUVWXYZ\\",3,font); plot_font_v(15,400,440,"abcdefghijklmnopqrstuvwxyz\\",2,font); plot_font_v(15,430,440,"ABCDEFGHIJKLMNOPQRSTUVWXYZ\\",2,font); plot_font_v(15,460,440,"abcdefghijklm\\",1,font); plot_font_v(15,500,440,"nopqrstuvwxyz\\",1,font); plot_font_v(15,540,440,"ABCDEFGHIJKLM\\",1,font); plot_font_v(15,580,440,"NOPQRSTUVWXYZ\\",1,font); plot_font_v(15,580,440,"NOPQRSTUVWXYZ\\",1,font); getch(); SetVideoMode(0); printf("Do you want to remake 'font.h' ? (y or n)\n\n"); if(getch()=='y') { fph=fopen("font.h","wt"); fprintf(fph,"int Font[128][25]=\n{"); for(i=0;i<128;i++) { fprintf(fph,"\n "); for(j=0;j<13;j++) fprintf(fph,"%3d,",font[i][j]); fprintf(fph,"\n "); for(j=13;j<24;j++) fprintf(fph,"%3d,",font[i][j]); fprintf(fph,"%3d",font[i][24]); if(i<127) fprintf(fph,","); else fprintf(fph,"\n};\n"); } fclose(fph); } } /*************************************************************************/ /***************************** end program main **************************/ /*************************************************************************/ /******************************************************************** ** ** decodes 'font.raw' and makes 'font.hex' ** ********************************************************************* */ void encode_font() { int i,j,k,l,m,n; int power; FILE *ffp; cfp = fopen("font.raw","r"); for(i='A';i<='Z';i++) { j = i - 'A' + 'a'; for(l=0;l