home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Gnuplot 3.5 / source / bitmap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-11  |  51.3 KB  |  1,084 lines  |  [TEXT/R*ch]

  1. #ifndef lint
  2. static char *RCSid = "$Id: bitmap.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - bitmap.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  27.  *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  28.  *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  29.  * 
  30.  * There is a mailing list for gnuplot users. Note, however, that the
  31.  * newsgroup 
  32.  *    comp.graphics.gnuplot 
  33.  * is identical to the mailing list (they
  34.  * both carry the same set of messages). We prefer that you read the
  35.  * messages through that newsgroup, to subscribing to the mailing list.
  36.  * (If you can read that newsgroup, and are already on the mailing list,
  37.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  38.  * removed from the mailing list.)
  39.  *
  40.  * The address for mailing to list members is
  41.  *       info-gnuplot@dartmouth.edu
  42.  * and for mailing administrative requests is 
  43.  *       info-gnuplot-request@dartmouth.edu
  44.  * The mailing list for bug reports is 
  45.  *       bug-gnuplot@dartmouth.edu
  46.  * The list of those interested in beta-test versions is
  47.  *       info-gnuplot-beta@dartmouth.edu
  48.  */
  49.  
  50. /*
  51. ** General raster plotting routines.
  52. ** Raster routines written and copyrighted 1987 by
  53. ** Jyrki Yli-Nokari (jty@intrin.UUCP)
  54. ** Intrinsic, Ltd.
  55. **
  56. ** You may use this code for anything you like as long as
  57. ** you are not selling it and the credit is given and
  58. ** this message retained.
  59. **
  60. */
  61.  
  62. /* Bitmap plotting routines derived from above raster plotting routines
  63.  * Russell Lang, 1990
  64.  */
  65.  
  66. #include <stdio.h>
  67. #include "plot.h"
  68. #ifdef THINK_C
  69. #include "tout_protos.h"
  70. #endif
  71.  
  72. #include "bitmap.h"
  73.  
  74. bitmap *b_p = (bitmap *)NULL;    /* global pointer to bitmap */
  75. unsigned int b_currx, b_curry;    /* the current coordinates */
  76. unsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  77. unsigned int b_planes;            /* number of color planes */
  78. unsigned int b_psize;            /* size of each plane */
  79. unsigned int b_rastermode;        /* raster mode rotates -90deg */
  80. unsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  81. unsigned int b_value = 1;        /* colour of lines */
  82. unsigned int b_hchar;            /* width of characters */
  83. unsigned int b_hbits;            /* actual bits in char horizontally */
  84. unsigned int b_vchar;            /* height of characters */
  85. unsigned int b_vbits;            /* actual bits in char vertically */
  86. unsigned int b_angle;            /* rotation of text */
  87. char_box b_font[FNT_CHARS];    /* the current font */
  88. unsigned int b_pattern[] = {0xffff, 0x1111,
  89.     0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  90. int b_maskcount = 0;
  91. unsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  92.  
  93. #define IN(i,size)  ((unsigned)i < (unsigned)size)
  94.  
  95. /* 5x9 font, bottom row first, left pixel in lsb */
  96. char_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  97.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  98.   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  99.   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  100.   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  101.   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  102.   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  103.   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  104.   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  105.   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  106.   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  107.   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  108.   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  109.   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  110.   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  111.   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  112.   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  113.   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  114.   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  115.   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  116.   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  117.   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  118.   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  119.   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  120.   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  121.   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  122.   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  123.   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  124.   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  125.   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  126.   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  127.   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  128.   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  129.   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  130.   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  131.   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  132.   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  133.   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  134.   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  135.   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  136.   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  137.   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  138.   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  139.   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  140.   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  141.   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  142.   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  143.   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  144.   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  145.   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  146.   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  147.   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  148.   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  149.   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  150.   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  151.   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  152.   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  153.   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  154.   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  155.   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  156.   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  157.   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  158.   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  159.   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  160.   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  161.   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  162.   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  163.   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  164.   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  165.   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  166.   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  167.   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  168.   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  169.   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  170.   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  171.   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  172.   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  173.   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  174.   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  175.   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  176.   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  177.   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  178.   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  179.   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  180.   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  181.   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  182.   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  183.   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  184.   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  185.   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  186.   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  187.   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  188.   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  189.   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  190.   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  191.   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  192.   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  193. };
  194.  
  195. /* 9x17 font, bottom row first, left pixel in lsb */
  196. char_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  197.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  198.           000000,000000,000000,000000,000000,000000,000000,000000},
  199.   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  200.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  201.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  202.           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  203.   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  204.           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  205.   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  206.           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  207.   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  208.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  209.   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  210.           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  211.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  212.           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  213.   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  214.           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  215.   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  216.           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  217.   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  218.           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  219.   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  220.           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  221.   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  222.           000000,000000,000000,000000,000000,000000,000000,000000},
  223.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  224.           000000,0x01ff,000000,000000,000000,000000,000000,000000},
  225.   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  226.           000000,000000,000000,000000,000000,000000,000000,000000},
  227.   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  228.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  229.   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  230.           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  231.   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  232.           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  233.   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  234.           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  235.   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  236.           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  237.   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  238.           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  239.   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  240.           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  241.   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  242.           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  243.   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  244.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  245.   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  246.           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  247.   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  248.           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  249.   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  250.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  251.   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  252.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  253.   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  254.           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  255.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  256.           000000,000000,000000,0x01ff,000000,000000,000000,000000},
  257.   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  258.           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  259.   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  260.           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  261.   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  262.           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  263.   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  264.           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  265.   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  266.           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  267.   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  268.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  269.   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  270.           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  271.   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  272.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  273.   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  274.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  275.   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  276.           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  277.   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  278.           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  279.   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  280.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  281.   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  282.           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  283.   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  284.           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  285.   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  286.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  287.   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  288.           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  289.   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  290.           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  291.   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  292.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  293.   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  294.           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  295.   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  296.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  297.   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  298.           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  299.   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  300.           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  301.   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  302.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  303.   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  304.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  305.   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  306.           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  307.   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  308.           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  309.   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  310.           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  311.   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  312.           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  313.   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  314.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  315.   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  316.           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  317.   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  318.           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  319.   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  320.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  321.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  322.           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  323.   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  324.           000000,000000,000000,000000,000000,000000,000000,000000},
  325.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  326.           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  327.   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  328.           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  329.   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  330.           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  331.   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  332.           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  333.   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  334.           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  335.   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  336.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  337.   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  338.           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  339.   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  340.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  341.   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  342.           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  343.   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  344.           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  345.   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  346.           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  347.   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  348.           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  349.   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  350.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  351.   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  352.           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  353.   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  354.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  355.   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  356.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  357.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  358.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  359.   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  360.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  361.   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  362.           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  363.   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  364.           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  365.   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  366.           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  367.   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  368.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  369.   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  370.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  371.   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  372.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  373.   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  374.           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  375.   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  376.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  377.   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  378.           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  379.   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  380.           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  381.   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  382.           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  383.   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  384.           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  385.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  386.           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  387.   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  388.           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  389. };
  390.  
  391. /* 13x25 font, bottom row first, left pixel in lsb */
  392. char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  393.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  394.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  395.           000000,000000,000000,000000,000000,000000,000000},
  396.   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  397.           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  398.           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  399.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  400.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  401.           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  402.   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  403.           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  404.           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  405.   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  406.           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  407.           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  408.   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  409.           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  410.           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  411.   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  412.           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  413.           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  414.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  415.           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  416.           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  417.   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  418.           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  419.           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  420.   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  421.           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  422.           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  423.   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  424.           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  425.           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  426.   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  427.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  428.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  429.   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  430.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  431.           000000,000000,000000,000000,000000,000000,000000},
  432.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  433.           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  434.           000000,000000,000000,000000,000000,000000,000000},
  435.   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  436.           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  437.           000000,000000,000000,000000,000000,000000,000000},
  438.   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  439.           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  440.           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  441.   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  442.           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  443.           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  444.   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  445.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  446.           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  447.   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  448.           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  449.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  450.   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  451.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  452.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  453.   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  454.           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  455.           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  456.   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  457.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  458.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  459.   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  460.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  461.           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  462.   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  463.           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  464.           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  465.   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  466.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  467.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  468.   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  469.           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  470.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  471.   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  472.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  473.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  474.   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  475.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  476.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  477.   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  478.           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  479.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  480.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  481.           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  482.           0x1fff,000000,000000,000000,000000,000000,000000},
  483.   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  484.           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  485.           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  486.   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  487.           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  488.           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  489.   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  490.           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  491.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  492.   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  493.           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  494.           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  495.   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  496.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  497.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  498.   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  499.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  500.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  501.   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  502.           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  503.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  504.   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  505.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  506.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  507.   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  508.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  509.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  510.   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  511.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  512.           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  513.   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  514.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  515.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  516.   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  517.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  518.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  519.   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  520.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  521.           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  522.   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  523.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  524.           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  525.   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  526.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  527.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  528.   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  529.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  530.           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  531.   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  532.           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  533.           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  534.   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  535.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  536.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  537.   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  538.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  539.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  540.   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  541.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  542.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  543.   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  544.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  545.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  546.   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  547.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  548.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  549.   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  550.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  551.           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  552.   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  553.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  554.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  555.   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  556.           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  557.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  558.   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  559.           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  560.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  561.   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  562.           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  563.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  564.   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  565.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  566.           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  567.   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  568.           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  569.           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  570.   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  571.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  572.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  573.   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  574.           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  575.           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  576.   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  577.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  578.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  579.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  580.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  581.           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  582.   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  583.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  584.           000000,000000,000000,000000,000000,000000,000000},
  585.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  586.           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  587.           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  588.   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  589.           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  590.           0x03f8,000000,000000,000000,000000,000000,000000},
  591.   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  592.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  593.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  594.   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  595.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  596.           0x03f8,000000,000000,000000,000000,000000,000000},
  597.   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  598.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  599.           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  600.   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  601.           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  602.           0x03f8,000000,000000,000000,000000,000000,000000},
  603.   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  604.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  605.           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  606.   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  607.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  608.           0x13f8,000000,000000,000000,000000,000000,000000},
  609.   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  610.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  611.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  612.   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  613.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  614.           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  615.   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  616.           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  617.           000000,000000,000000,0x0700,0x0700,0x0700,000000},
  618.   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  619.           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  620.           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  621.   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  622.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  623.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  624.   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  625.           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  626.           0x0209,000000,000000,000000,000000,000000,000000},
  627.   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  628.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  629.           0x03f9,000000,000000,000000,000000,000000,000000},
  630.   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  631.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  632.           0x03f8,000000,000000,000000,000000,000000,000000},
  633.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  634.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  635.           0x03f9,000000,000000,000000,000000,000000,000000},
  636.   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  637.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  638.           0x13f8,000000,000000,000000,000000,000000,000000},
  639.   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  640.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  641.           0x03f9,000000,000000,000000,000000,000000,000000},
  642.   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  643.           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  644.           0x07f8,000000,000000,000000,000000,000000,000000},
  645.   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  646.           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  647.           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  648.   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  649.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  650.           0x1001,000000,000000,000000,000000,000000,000000},
  651.   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  652.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  653.           0x1001,000000,000000,000000,000000,000000,000000},
  654.   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  655.           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  656.           0x1001,000000,000000,000000,000000,000000,000000},
  657.   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  658.           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  659.           0x1001,000000,000000,000000,000000,000000,000000},
  660.   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  661.           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  662.           0x1001,000000,000000,000000,000000,000000,000000},
  663.   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  664.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  665.           0x1fff,000000,000000,000000,000000,000000,000000},
  666.   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  667.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  668.           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  669.   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  670.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  671.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  672.   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  673.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  674.           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  675.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  676.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  677.           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  678.   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  679.           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  680.           0x1249,000000,000000,0x1249,000000,000000,0x1249},
  681. };
  682.  
  683. /*
  684. ** The plotting area is defined as a huge bitmap.
  685. ** The bitmap is stored in a dynamically allocated pixel array b_p
  686. **
  687. ** The bitmap is allocated (and initialized to zero) with
  688. ** b_makebitmap(xsize, ysize, planes)
  689. ** and freed with b_freebitmap()
  690. ** xsize and ysize will be rounded up to a multiple of 8.
  691. **
  692. ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  693. **
  694. ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  695. ** where the point (x,y) is the target to go from the current point
  696. ** To set the color use b_setvalue(value) where value is the value 
  697. ** (0 or 1 or a color number) to be stored in every pixel.
  698. ** To get dotted line styles, use b_setlinetype(linetype).
  699. **
  700. ** Internally all plotting goes through b_setpixel(x, y, value).
  701. */
  702.  
  703.  
  704. /*
  705. ** set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  706. */
  707. void
  708. b_setpixel(x, y, value)
  709. unsigned int x, y, value;
  710. {
  711.   register unsigned int row;
  712.   register unsigned char mask;
  713.   int i;
  714.   if (b_rastermode) {
  715.     /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  716.     row = x;  /* temp storage */
  717.     x = y;
  718.     y = b_ysize-1-row;
  719.   }
  720.   if (IN(x, b_xsize) && IN(y, b_ysize))
  721.   {
  722.     row = y/8;
  723.     mask = 1<<(y%8);
  724.  
  725.     for (i=0; i<b_planes; i++) {
  726.         if (value&1)
  727.             *((*b_p)[row]+x) |= mask;
  728.         else
  729.             *((*b_p)[row]+x) &= ~mask;
  730.         row += b_psize;
  731.         value >>= 1;
  732.     }
  733.   }
  734. #ifdef BITMAPDEBUG
  735.   else
  736.   {
  737.     if (b_rastermode)
  738.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n", 
  739.         b_ysize-1-y, x, value);
  740.     else
  741.       fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  742.         x, y, value);
  743.   }
  744. #endif
  745. }
  746.  
  747. /*
  748. ** get pixel (x,y) value----unused
  749. */
  750. /****************************
  751. unsigned int
  752. b_getpixel(x, y)
  753. unsigned int x, y;
  754. {
  755.   register unsigned int row;
  756.   register unsigned char mask;
  757.   register unsigned char value;
  758.   int i;
  759.  
  760.   if (b_rastermode) {
  761.     row = x;
  762.     x = y;
  763.     y = b_ysize-1-row;
  764.   }
  765.   if (IN(x, b_xsize) && IN(y, b_ysize))
  766.   {
  767.     row = y/8 + (b_planes-1)*b_psize;
  768.     mask = 1<<(y%8);
  769.  
  770.     for (i=0; i<b_planes; i++) {
  771.         if ( *((*b_p)[row]+x) & mask )
  772.             value |= 1;
  773.         row -= b_psize;
  774.         value <<= 1;
  775.     }
  776.     return(value);
  777.   }
  778.   else
  779.   {
  780. #ifdef BITMAPDEBUG
  781.     if (b_rastermode)
  782.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  783.         b_ysize-1-y, x);
  784.     else
  785.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  786. #endif
  787.     return(0);
  788.   }
  789. }
  790. ********************************/
  791.  
  792. /*
  793. ** allocate the bitmap
  794. */
  795. void
  796. b_makebitmap(x, y, planes)
  797. unsigned int x, y, planes;
  798. {
  799.   register unsigned j;
  800.   unsigned rows;
  801.  
  802.   x = 8 * (unsigned int)(x/8.0+0.9);    /* round up to multiple of 8 */
  803.   y = 8 * (unsigned int)(y/8.0+0.9);    /* round up to multiple of 8 */
  804.   b_psize = y/8;                    /* size of each plane */
  805.   rows = b_psize * planes;            /* total number of rows of 8 pixels high */
  806.   b_xsize = x; b_ysize = y;
  807.   b_currx = b_curry = 0;
  808.   b_planes = planes;
  809.   b_value = 1;
  810.   b_angle = 0;
  811.   b_rastermode = 0;
  812.   /* allocate row pointers */
  813.   b_p = (bitmap *)alloc( (unsigned long)rows * sizeof(pixels *), "bitmap row buffer");
  814.   bzero(b_p, rows * sizeof(pixels *));
  815.   for (j = 0; j < rows; j++) {
  816.     /* allocate bitmap buffers */
  817.     (*b_p)[j] = (pixels *)alloc((unsigned long)x * sizeof(pixels),(char *)NULL);
  818.     if ((*b_p)[j] == (pixels *)NULL) {
  819.         b_freebitmap();  /* free what we have already allocated */
  820.         int_error("out of memory for bitmap buffer", NO_CARET);
  821.     }
  822.     bzero((*b_p)[j], x * sizeof(pixels));
  823.   }
  824. }
  825.   
  826. /*
  827. ** free the allocated bitmap
  828. */
  829. void
  830. b_freebitmap()
  831. {
  832.   int j;
  833.   unsigned rows;
  834.  
  835.   rows = b_psize * b_planes;   /* total number of rows of 8 pixels high */
  836.   for (j = 0; j < rows; j++)
  837.   {
  838.     (void) free((char *)(*b_p)[j]);
  839.   }
  840.   (void) free((char *)b_p);
  841.   b_p = (bitmap *)(NULL);
  842. }
  843.  
  844. /*
  845. ** set pixel at (x,y) with color b_value and dotted mask b_linemask.
  846. */
  847. void
  848. b_setmaskpixel(x,y,value)
  849. unsigned int x,y,value;
  850. {
  851.     /* dotted line generator */
  852.     if ((b_linemask>>b_maskcount)&(unsigned int)(1)) {
  853.         b_setpixel(x,y,value);
  854.     }
  855.     b_maskcount= (b_maskcount+1) % 16;
  856.     b_lastx= x;  /* last pixel set with mask */
  857.     b_lasty= y;
  858. }
  859.  
  860. /*
  861. ** draw a line from (x1,y1) to (x2,y2)
  862. ** with color b_value and dotted mask b_linemask.
  863. */
  864. void
  865. b_line(x1,y1,x2,y2)
  866. unsigned int x1,y1,x2,y2;
  867. {
  868. int runcount;
  869. int dx,dy;
  870. int xinc,yinc;
  871. unsigned int xplot,yplot;
  872.  
  873.     runcount=0;
  874.     dx = abs((int)(x1)-(int)(x2));
  875.     if (x2>x1)  xinc=  1;
  876.     if (x2==x1) xinc=  0;
  877.     if (x2<x1)  xinc= -1;
  878.     dy = abs((int)(y1)-(int)(y2));
  879.     if (y2>y1)  yinc=  1;
  880.     if (y2==y1) yinc=  0;
  881.     if (y2<y1)  yinc= -1;
  882.     xplot=x1;
  883.     yplot=y1;
  884.     if (dx>dy) {
  885.         /* iterate x */
  886.         if ( (b_linemask==0xffff) ||
  887.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  888.             b_setmaskpixel(xplot,yplot,b_value);
  889.         while (xplot!=x2) {
  890.             xplot+=xinc;
  891.             runcount+=dy;
  892.             if (runcount>=(dx-runcount)) {
  893.                 yplot+=yinc;
  894.                 runcount-=dx;
  895.             }
  896.             b_setmaskpixel(xplot,yplot,b_value);
  897.         }
  898.     } else {
  899.         /* iterate y */
  900.         if ( (b_linemask==0xffff) ||
  901.             ((xplot!=b_lastx) && (yplot!=b_lasty)) )
  902.             b_setmaskpixel(xplot,yplot,b_value);
  903.         while (yplot!=y2) {
  904.             yplot+=yinc;
  905.             runcount+=dx;
  906.             if (runcount>=(dy-runcount)) {
  907.                 xplot+=xinc;
  908.                 runcount-=dy;
  909.             }
  910.             b_setmaskpixel(xplot,yplot,b_value);
  911.         }
  912.     }
  913. }
  914.  
  915. /*
  916. ** set character size
  917. */
  918. void
  919. b_charsize(size)
  920. unsigned int size;
  921. {
  922.     int j;
  923.     switch(size) {
  924.         case FNT5X9:
  925.             b_hchar = FNT5X9_HCHAR;
  926.             b_hbits = FNT5X9_HBITS;
  927.             b_vchar = FNT5X9_VCHAR;
  928.             b_vbits = FNT5X9_VBITS;
  929.             for (j = 0; j < FNT_CHARS; j++ )
  930.                 b_font[j] = &fnt5x9[j][0];
  931.             break;
  932.         case FNT9X17:
  933.             b_hchar = FNT9X17_HCHAR;
  934.             b_hbits = FNT9X17_HBITS;
  935.             b_vchar = FNT9X17_VCHAR;
  936.             b_vbits = FNT9X17_VBITS;
  937.             for (j = 0; j < FNT_CHARS; j++ )
  938.                 b_font[j] = &fnt9x17[j][0];
  939.             break;
  940.         case FNT13X25:
  941.             b_hchar = FNT13X25_HCHAR;
  942.             b_hbits = FNT13X25_HBITS;
  943.             b_vchar = FNT13X25_VCHAR;
  944.             b_vbits = FNT13X25_VBITS;
  945.             for (j = 0; j < FNT_CHARS; j++ )
  946.                 b_font[j] = &fnt13x25[j][0];
  947.             break;
  948.         default:
  949.             int_error("Unknown character size",NO_CARET);
  950.     }
  951. }
  952.  
  953.  
  954. /*
  955. ** put characater c at (x,y) rotated by angle with color b_value.
  956. */
  957. #ifdef THINK_C
  958. void
  959. b_putc(unsigned int x, unsigned int y, char c, unsigned int angle)
  960. #else
  961. void
  962. b_putc(x,y,c,angle)
  963. unsigned int x,y;
  964. char c;
  965. unsigned int angle;
  966. #endif
  967. {
  968.     unsigned int i, j, k;
  969.     char_row fc;
  970.  
  971.     j = c - ' ';
  972.     for ( i = 0; i < b_vbits; i++ ) {
  973.         fc = *( b_font[j] + i );
  974.         if ( c == '_' ) {    /* treat underline specially */
  975.             if ( fc  ) {    /* this this the underline row ? */
  976.                 /* draw the under line for the full h_char width */
  977.                 for ( k = ( b_hbits - b_hchar )/2;
  978.                     k < ( b_hbits + b_hchar )/2; k++ ) {
  979.                     switch(angle) {
  980.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  981.                             break;
  982.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  983.                             break;
  984.                     }
  985.                 }
  986.             }
  987.         }
  988.         else {
  989.             /* draw character */
  990.             for ( k = 0; k < b_hbits; k++ ) {
  991.                 if ( ( fc >> k ) & 1 ) {
  992.                     switch(angle) {
  993.                         case 0 : b_setpixel(x+k+1,y+i,b_value);
  994.                             break;
  995.                         case 1 : b_setpixel(x-i,y+k+1,b_value);
  996.                             break;
  997.                     }
  998.                 }
  999.             }
  1000.         }
  1001.     }
  1002. }
  1003.  
  1004.  
  1005. /*
  1006. ** set b_linemask to b_pattern[linetype]
  1007. */
  1008. int
  1009. b_setlinetype(linetype)
  1010. int linetype;
  1011. {
  1012.     if (linetype>=7)
  1013.         linetype %= 7;
  1014.     b_linemask = b_pattern[linetype+2];
  1015.     b_maskcount=0;
  1016. }
  1017.  
  1018. /*
  1019. ** set b_value to value
  1020. */
  1021. void
  1022. b_setvalue(value)
  1023. unsigned int value;
  1024. {
  1025.     b_value = value;
  1026. }
  1027.  
  1028. /*
  1029. ** move to (x,y)
  1030. */
  1031. int
  1032. b_move(x, y)
  1033. unsigned int x, y;
  1034. {
  1035.   b_currx = x;
  1036.   b_curry = y;
  1037. }
  1038.  
  1039. /*
  1040. ** draw to (x,y) with color b_value
  1041. */
  1042. int
  1043. b_vector(x, y)
  1044. unsigned int x, y;
  1045. {
  1046.   b_line(b_currx, b_curry, x, y);
  1047.   b_currx = x;
  1048.   b_curry = y;
  1049. }
  1050.  
  1051.  
  1052. /*
  1053. ** put text str at (x,y) with color b_value and rotation b_angle
  1054. */
  1055. int
  1056. b_put_text(x,y,str)
  1057. unsigned int x, y;
  1058. char *str;
  1059. {
  1060.     if (b_angle == 1)
  1061.         x += b_vchar/2;
  1062.     else
  1063.         y -= b_vchar/2;
  1064.    switch (b_angle) {
  1065.       case 0:
  1066.      for (; *str; ++str, x += b_hchar)
  1067.         b_putc (x, y, *str, b_angle);
  1068.                     break;
  1069.       case 1:
  1070.      for (; *str; ++str, y += b_hchar)
  1071.         b_putc (x, y, *str, b_angle);
  1072.                     break;
  1073.     }
  1074. }
  1075.  
  1076.  
  1077. int
  1078. b_text_angle(ang)
  1079. int ang;
  1080. {
  1081.     b_angle=(unsigned int)ang;
  1082.     return TRUE;
  1083. }
  1084.