#include <stdio.h>

char bdfhead[]=
"STARTFONT 2.1\n"
"COMMENT X\n"
"FONT vga12x24\n"
"SIZE 24 100 100\n"
"FONTBOUNDINGBOX 12 24 0 -2\n"
"STARTPROPERTIES 19\n"
"FONTNAME_REGISTRY \"\"\n"
"FOUNDRY \"Eten\"\n"
"FAMILY_NAME \"Fixed\"\n"
"WEIGHT_NAME \"Medium\"\n"
"SLANT \"R\"\n"
"SETWIDTH_NAME \"Normal\"\n"
"ADD_STYLE_NAME \"\"\n"
"PIXEL_SIZE 24\n"
"POINT_SIZE 170\n"
"RESOLUTION_X 100\n"
"RESOLUTION_Y 100\n"
"SPACING \"C\"\n"
"AVERAGE_WIDTH 120\n"
"CHARSET_REGISTRY \"ISO8859\"\n"
"CHARSET_ENCODING \"1\"\n"
"DEFAULT_CHAR 32\n"
"FONT_DESCENT 2\n"
"FONT_ASCENT 22\n"
"COPYRIGHT \"Eten Info Sys Corp \"\n"
"ENDPROPERTIES\n"
"CHARS 256\n";

main()
{
 FILE *fr,*fw;
 int i,j;

 if ((fr=fopen("ascfont.24", "rb"))==NULL) {
   printf("Error Open font\n");
   exit(1);
 }

 if ((fw=fopen("vga12x24.bdf", "w"))==NULL) {
   printf("Error Open font\n");
   exit(1);
 }
 fputs(bdfhead,fw);

 for(i=0;i<256;i++) {
   fprintf(fw, "STARTCHAR C%03d\n", i);
   fprintf(fw, "ENCODING %d\n", i); 
   fprintf(fw, "SWIDTH 508 0\n");
   fprintf(fw, "DWIDTH 12 0\n");
   fprintf(fw, "BBX 12 24 0 -2\n");
   fprintf(fw, "BITMAP\n");
  
   for(j=0;j<24;j++) {
     unsigned char tt[2];
     fread(tt,1,2, fr);
     fprintf(fw, "%02x%02x\n", tt[0], tt[1]);
   }

   fprintf(fw, "ENDCHAR\n");
 
 }
 fprintf(fw, "ENDFONT\n");
#if	0
 system("bdftopcf vga12x24.bdf -o vga12x24.pcf");
#endif
}
