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