4
* PURPOSE: This program demonstrates how a PK file can be created from
5
* a single character bitmap.
7
* USAGE: pktest -c<char_code> -W<with> -H<Height> pkname < test.bm
8
* (test.bm contains the character from `The GFtoPK processor')
12
* AUTHOR: Piet Tutelaers (rcpt@urc.tue.nl)
17
#include "basics.h" /* fatal() */
20
main(int argc, char *argv[])
22
int done, C = 0, W = 0, H = 0, c;
23
char *myname, *pkname, comment[256];
27
while (--argc > 0 && (*++argv)[0] == '-') {
29
while ((!done) && (c = *++argv[0])) /* allow multiletter options */
34
argc--; C = *++argv[0];
38
if (*++argv[0] == '\0') {
41
H = atoi(*argv); done = 1;
44
if (*++argv[0] == '\0') {
47
W = atoi(*argv); done = 1;
50
fatal("%s: %c illegal option\n", myname, c);
54
if (argc == 0 || C == 0 || W*H == 0)
55
fatal("Usage: %s -c<char> -W<width> -H<height> pkfile\n", myname);
60
sprintf(comment, "Testfont %s designed at 10 points", pkname);
61
pk_preamble(comment, 10.0, 1473505522, 120, 120);
62
printf("character %c Width %d Height %d\n", C, W, H);
63
pk_char(C, 640796, 25, W, H, -2, 28, next_pixel);
68
/* This function delivers the pixels from the character's bounding box
69
* from left to right and from top to bottom.
74
if (c==EOF) fatal("reading past end of file!\n");
75
if (c == '*' || c == 'X') return BLACK;
76
if (c == '.') return WHITE;
80
/* The character example from GFtoPK: