Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / amiga / stand / dumpfont / dumpfont.c
blobb12eac9d436efa1940979dc07f5c872f6450a694
1 /* $NetBSD: dumpfont.c,v 1.5 1994/10/26 02:06:57 cgd Exp $ */
3 /*
4 * This is a *real* hack to dump the topaz80 kernel font. This one is
5 * ways nicer than the ugly Mach font, but we'll have to dump it from a
6 * running system to not run against Commodore copyrights. *NEVER* distribute
7 * the generated font with BSD, always regenerate!
8 */
10 #include <exec/types.h>
11 #include <exec/memory.h>
12 #include <dos/dos.h>
13 #include <graphics/gfx.h>
14 #include <graphics/rastport.h>
15 #include <graphics/text.h>
17 #include <inline/exec.h>
18 #include <inline/graphics.h>
20 #include <stdio.h>
22 int
23 main(void)
25 unsigned char str[256], *pp;
26 int i;
27 struct TextAttr ta = { "topaz.font", 8, FS_NORMAL, FPF_ROMFONT };
28 struct RastPort rp;
29 struct BitMap bm = { 256, /* bytes per row */
30 8, /* rows */
31 0, /* flags */
32 1, /* depth */
33 0, /* pad */
34 0 }; /* planes */
35 struct TextFont *tf;
37 InitRastPort (& rp);
38 rp.BitMap = &bm;
39 bm.Planes[0] = pp = AllocRaster (256 * 8, 8);
41 if (!pp)
43 fprintf (stderr, "Can't allocate raster!\n");
44 exit (1);
46 bzero (pp, 256 * 8);
48 tf = OpenFont (& ta);
49 if (! tf)
51 fprintf (stderr, "can't open topaz font.\n");
52 exit (1);
55 SetFont (&rp, tf);
57 /* initialize string to be printed */
58 for (i = 32; i < 256; i++) str[i - 32] = i;
60 Move (&rp, 0, 6);
62 Text (&rp, str, 256 - 32);
64 int bin = open ("bitmap", 1);
65 if (bin >= 0)
67 write (bin, pp, 256*8);
68 close (bin);
72 /* dump them.. */
73 printf ("/* generated automatically by dumpfont.c. *DONT* distribute\n");
74 printf (" this file, it contains information Copyright by Commodore!\n");
75 printf ("\n");
76 printf (" This is the (new) topaz80 system font: */\n\n");
78 printf ("unsigned char kernel_font_width = 8;\n");
79 printf ("unsigned char kernel_font_height = 8;\n");
80 printf ("unsigned char kernel_font_lo = 32;\n");
81 printf ("unsigned char kernel_font_hi = 255;\n\n");
83 printf ("unsigned char kernel_cursor[] = {\n");
84 printf (" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\n\n");
85 printf ("unsigned char kernel_font[] = {\n");
87 for (i = 0; i < 256 - 32; i++)
89 printf( "/* %c */ ", i + 32);
90 printf( "0x%02x, 0x%02x, 0x%02x, 0x%02x, "
91 "0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
92 pp[i+0*256], pp[i+1*256], pp[i+2*256], pp[i+3*256],
93 pp[i+4*256], pp[i+5*256], pp[i+6*256], pp[i+7*256]);
95 printf ("};\n");
97 CloseFont (tf);
98 FreeRaster (pp, 256 * 8, 8);