1 /****************************************************************************
2 * FONTDATA: A "fontdata.h" File Generator *
3 * Copyright John A. Magliacane, KD2BD 2002 *
4 * Last update: 13-Apr-2002 *
5 *****************************************************************************
7 * This utility reads gzip compressed font data, and generates a fontdata.h *
8 * file required for compilation of SPLAT!. Slackware Linux users may *
9 * find compatible console font data files under /usr/lib/kbd/consolefonts *
10 * (Slackware < version 8), or /usr/share/kbd/consolefonts (Slackware 8). *
12 * Example: fontdata s.fnt.gz *
13 * Writes s.fnt font data to "fontdata.h" in current working directory. *
15 *****************************************************************************
16 * To compile: gcc -Wall -O6 -s -lz fontdata.c -o fontdata *
17 *****************************************************************************
19 * This program is free software; you can redistribute it and/or modify it *
20 * under the terms of the GNU General Public License as published by the *
21 * Free Software Foundation; either version 2 of the License or any later *
24 * This program is distributed in the hope that it will useful, but WITHOUT *
25 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
26 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
29 *****************************************************************************/
42 unsigned char line, input;
43 FILE *infile, *outfile;
46 infile=gzopen(argv[1],"rb");
50 fprintf(stderr,"Usage: fontdata fontfile.gz\n");
56 outfile=fopen("fontdata.h","wb");
58 fprintf(outfile,"static char fontdata[] = {\n ");
60 for (x=0, line=0; x<4096; x++)
64 fprintf(outfile," 0x%.2x",input);
72 fprintf(outfile,"\n ");
77 fprintf(outfile," };\n");
82 printf("fontdata.h successfully written!\n");
87 fprintf(stderr,"%c*** Error: %c%s%c Not Found!\n",7,34,argv[1],34);