home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / OS2 / DWNSRT47.ZIP / DOWNFNT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-01  |  24.5 KB  |  474 lines

  1. /* ============================================================= */
  2. /*  Rob Hamerling's MAXIMUS DOWNload file SORT and list utility. */
  3. /*  -> Block font definitions and generation routine.            */
  4. /* ============================================================= */
  5.  
  6. #define INCL_BASE
  7. #include <os2.h>
  8.  
  9. #include "downsort.h"
  10.  
  11. #include <ctype.h>
  12. #include <string.h>
  13.  
  14. struct _b8_patt {                       // 8 column font
  15.         unsigned c0:3, c1:3, c2:3, c3:3, c4:3, c5:3, c6:3, c7:3; };
  16. struct _b8x5 {                          // all fonts defined as 8x5
  17.          char           c;              // the character
  18.          unsigned char  k;              // number of active columns
  19.          struct _b8_patt p[5];          // 8 column x 5 lines pattern
  20.            };
  21.  
  22. /* ===================================================== */
  23. /* Generate string of block-characters (1 part per call) */
  24. /* ===================================================== */
  25. char *strnblk(b,n,f,k)
  26. char  *b;                               // b=input buffer (string)
  27. int   n;                                // number of characters
  28. int   f;                                // font number
  29. int   k;                                // part (relative line 0, 1 or 2)
  30. {
  31.   int   i,j,x,w;                        // counters
  32.  
  33.   static struct _b8x5 f1[] = {          // simple 5x3 font
  34.     {'A',6, 1,2,2,2,1,0,0,0, 3,1,1,1,3,0,0,0, 3,0,0,0,3,0,0,0,
  35.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  36.     {'B',6, 3,2,2,2,1,0,0,0, 3,2,2,2,1,0,0,0, 3,1,1,1,2,0,0,0,
  37.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  38.     {'C',6, 1,2,2,2,1,0,0,0, 3,0,0,0,0,0,0,0, 2,1,1,1,2,0,0,0,
  39.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  40.     {'D',6, 3,2,2,2,1,0,0,0, 3,0,0,0,3,0,0,0, 3,1,1,1,2,0,0,0,
  41.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  42.     {'E',6, 3,2,2,2,2,0,0,0, 3,2,2,0,0,0,0,0, 3,1,1,1,1,0,0,0,
  43.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  44.     {'F',6, 3,2,2,2,2,0,0,0, 3,1,1,0,0,0,0,0, 3,0,0,0,0,0,0,0,
  45.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  46.     {'G',6, 1,2,2,2,1,0,0,0, 3,0,0,1,1,0,0,0, 2,1,1,1,2,0,0,0,
  47.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  48.     {'H',6, 3,0,0,0,3,0,0,0, 3,1,1,1,3,0,0,0, 3,0,0,0,3,0,0,0,
  49.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  50.     {'I',4, 2,3,2,0,0,0,0,0, 0,3,0,0,0,0,0,0, 1,3,1,0,0,0,0,0,
  51.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  52.     {'J',6, 0,2,2,2,3,0,0,0, 0,0,0,0,3,0,0,0, 2,1,1,1,2,0,0,0,
  53.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  54.     {'K',6, 3,0,0,1,2,0,0,0, 3,2,2,1,0,0,0,0, 3,0,0,0,3,0,0,0,
  55.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  56.     {'L',6, 3,0,0,0,0,0,0,0, 3,0,0,0,0,0,0,0, 3,1,1,1,1,0,0,0,
  57.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  58.     {'M',6, 3,1,0,1,3,0,0,0, 3,2,3,2,3,0,0,0, 3,0,0,0,3,0,0,0,
  59.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  60.     {'N',6, 3,1,0,0,3,0,0,0, 3,2,3,1,3,0,0,0, 3,0,0,2,3,0,0,0,
  61.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  62.     {'O',6, 1,2,2,2,1,0,0,0, 3,0,0,0,3,0,0,0, 2,1,1,1,2,0,0,0,
  63.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  64.     {'P',6, 3,2,2,2,1,0,0,0, 3,1,1,1,2,0,0,0, 3,0,0,0,0,0,0,0,
  65.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  66.     {'Q',6, 1,2,2,2,1,0,0,0, 3,0,1,0,3,0,0,0, 2,1,1,2,1,0,0,0,
  67.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  68.     {'R',6, 3,2,2,2,1,0,0,0, 3,1,1,1,2,0,0,0, 3,0,2,1,1,0,0,0,
  69.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  70.     {'S',6, 1,2,2,2,2,0,0,0, 0,2,2,2,1,0,0,0, 1,1,1,1,2,0,0,0,
  71.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  72.     {'T',6, 2,2,3,2,2,0,0,0, 0,0,3,0,0,0,0,0, 0,0,3,0,0,0,0,0,
  73.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  74.     {'U',6, 3,0,0,0,3,0,0,0, 3,0,0,0,3,0,0,0, 2,1,1,1,2,0,0,0,
  75.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  76.     {'V',6, 3,0,0,0,3,0,0,0, 3,1,0,1,3,0,0,0, 0,2,3,2,0,0,0,0,
  77.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  78.     {'W',6, 3,0,0,0,3,0,0,0, 3,0,1,0,3,0,0,0, 2,3,2,3,2,0,0,0,
  79.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  80.     {'X',6, 2,1,0,1,2,0,0,0, 0,0,3,0,0,0,0,0, 1,2,0,2,1,0,0,0,
  81.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  82.     {'Y',6, 3,0,0,0,3,0,0,0, 2,3,1,3,2,0,0,0, 0,0,3,0,0,0,0,0,
  83.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  84.     {'Z',6, 2,2,2,2,3,0,0,0, 0,1,2,2,0,0,0,0, 3,1,1,1,1,0,0,0,
  85.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  86.     {'0',6, 1,2,2,3,1,0,0,0, 3,0,3,0,3,0,0,0, 2,3,1,1,2,0,0,0,
  87.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  88.     {'1',4, 1,3,0,0,0,0,0,0, 0,3,0,0,0,0,0,0, 1,3,1,0,0,0,
  89.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  90.     {'2',6, 1,2,2,2,1,0,0,0, 0,1,1,1,2,0,0,0, 3,1,1,1,1,0,0,0,
  91.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  92.     {'3',6, 1,2,2,2,1,0,0,0, 0,0,2,2,1,0,0,0, 2,1,1,1,2,0,0,0,
  93.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  94.     {'4',6, 0,0,1,2,3,0,0,0, 1,2,0,0,3,0,0,0, 2,2,2,2,3,0,0,0,
  95.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  96.     {'5',6, 3,2,2,2,2,0,0,0, 2,2,2,2,1,0,0,0, 2,1,1,1,2,0,0,0,
  97.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  98.     {'6',6, 1,2,2,2,0,0,0,0, 3,2,2,2,1,0,0,0, 2,1,1,1,2,0,0,0,
  99.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  100.     {'7',6, 2,2,2,2,3,0,0,0, 0,0,1,2,0,0,0,0, 0,3,0,0,0,0,0,0,
  101.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  102.     {'8',6, 1,2,2,2,1,0,0,0, 1,2,2,2,1,0,0,0, 2,1,1,1,2,0,0,0,
  103.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  104.     {'9',6, 1,2,2,2,1,0,0,0, 2,1,1,1,3,0,0,0, 0,1,1,1,2,0,0,0,
  105.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  106.     {'_',6, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1,1,1,1,1,0,0,0,
  107.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  108.     {'*',6, 1,0,1,0,1,0,0,0, 1,3,2,3,1,0,0,0, 1,2,3,2,1,0,0,0,
  109.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  110.     {'-',4, 0,0,0,0,0,0,0,0, 1,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  111.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  112.     {'|',3, 0,3,0,0,0,0,0,0, 0,3,0,0,0,0,0,0, 0,3,0,0,0,0,0,0,
  113.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  114.     {'.',2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,
  115.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  116.     {'(',4, 0,1,2,0,0,0,0,0, 3,0,0,0,0,0,0,0, 0,2,1,0,0,0,0,0,
  117.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  118.     {')',4, 2,1,0,0,0,0,0,0, 0,0,3,0,0,0,0,0, 1,2,0,0,0,0,0,0,
  119.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  120.     {'[',4, 3,2,2,0,0,0,0,0, 3,0,0,0,0,0,0,0, 3,1,1,0,0,0,0,0,
  121.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  122.     {']',4, 2,2,3,0,0,0,0,0, 0,0,3,0,0,0,0,0, 1,1,3,0,0,0,0,0,
  123.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  124.     {'/',6, 0,0,0,0,1,0,0,0, 0,0,1,2,0,0,0,0, 1,2,0,0,0,0,0,0,
  125.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  126.    {'\\',6, 1,0,0,0,0,0,0,0, 0,2,1,0,0,0,0,0, 0,0,0,2,1,0,0,0,
  127.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  128.     {' ',4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  129.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  130.         };
  131.  
  132.   static struct _b8x5 f2[] = {          // 7x5 pseudo stencil
  133.     {'A',8, 0,3,3,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,6,3,3,3,3,0,
  134.             3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0},
  135.     {'B',8, 3,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,6,3,3,3,0,0,
  136.             3,3,0,0,0,3,3,0, 3,3,6,3,3,3,0,0},
  137.     {'C',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,0,0,0,
  138.             3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0},
  139.     {'D',8, 3,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0,
  140.             3,3,0,0,0,3,3,0, 3,3,6,3,3,3,0,0},
  141.     {'E',8, 3,3,6,3,3,3,3,0, 3,3,0,0,0,0,0,0, 3,3,6,3,3,0,0,0,
  142.             3,3,0,0,0,0,0,0, 3,3,6,3,3,3,3,0},
  143.     {'F',8, 3,3,6,3,3,3,3,0, 3,3,0,0,0,0,0,0, 3,3,6,3,3,0,0,0,
  144.             3,3,0,0,0,0,0,0, 3,3,0,0,0,0,0,0},
  145.     {'G',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,0,0,0,
  146.             3,3,0,0,2,3,3,0, 3,3,6,3,3,3,0,0},
  147.     {'H',8, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0, 3,3,6,3,3,3,3,0,
  148.             3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0},
  149.     {'I',6, 3,6,3,3,3,0,0,0, 0,6,3,3,0,0,0,0, 0,6,3,3,0,0,0,0,
  150.             0,6,3,3,0,0,0,0, 3,6,3,3,3,0,0,0},
  151.     {'J',8, 0,0,0,0,0,3,3,0, 0,0,0,0,0,3,3,0, 0,0,0,0,0,3,3,0,
  152.             3,6,0,0,0,3,3,0, 0,6,3,3,3,3,2,0},
  153.     {'K',8, 3,3,0,0,0,3,3,0, 3,3,0,3,3,0,0,0, 3,3,6,3,0,0,0,0,
  154.             3,3,0,3,3,0,0,0, 3,3,0,0,0,3,3,0},
  155.     {'L',8, 3,3,0,0,0,0,0,0, 3,3,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  156.             3,3,0,0,0,0,0,0, 3,3,6,3,3,3,3,0},
  157.     {'M',8, 3,3,6,3,3,3,3,0, 3,3,0,3,0,3,3,0, 3,3,0,3,0,3,3,0,
  158.             3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0},
  159.     {'N',7, 3,3,6,3,3,3,0,0, 3,3,0,0,3,3,0,0, 3,3,0,0,3,3,0,0,
  160.             3,3,0,0,3,3,0,0, 3,3,0,0,3,3,0,0},
  161.     {'O',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0,
  162.             3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0},
  163.     {'P',8, 3,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,6,3,3,3,0,0,
  164.             3,3,0,0,0,0,0,0, 3,3,0,0,0,0,0,0},
  165.     {'Q',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0,
  166.             3,3,0,0,3,3,0,0, 0,3,6,3,3,0,3,0},
  167.     {'R',8, 3,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 3,3,6,3,3,3,0,0,
  168.             3,3,0,3,0,0,0,0, 3,3,0,0,3,3,0,0},
  169.     {'S',8, 3,3,6,3,3,3,3,0, 3,3,0,0,0,0,0,0, 3,3,6,3,3,3,3,0,
  170.             0,0,0,0,0,3,3,0, 3,3,6,3,3,3,3,0},
  171.     {'T',8, 3,3,6,3,3,3,3,0, 0,0,6,3,3,0,0,0, 0,0,6,3,3,0,0,0,
  172.             0,0,6,3,3,0,0,0, 0,0,6,3,3,0,0,0},
  173.     {'U',8, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0,
  174.             3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0},
  175.     {'V',8, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0,
  176.             0,3,6,0,3,3,0,0, 0,0,6,3,3,0,0,0},
  177.     {'W',8, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0, 3,3,0,3,0,3,3,0,
  178.             3,3,0,3,0,3,3,0, 0,3,6,3,3,3,0,0},
  179.     {'X',8, 3,3,0,0,0,3,3,0, 0,3,6,0,3,3,0,0, 0,0,6,3,3,0,0,0,
  180.             0,3,6,0,3,3,0,0, 3,3,0,0,0,3,3,0},
  181.     {'Y',8, 3,3,0,0,0,3,3,0, 3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0,
  182.             0,0,0,3,3,0,0,0, 0,0,0,3,3,0,0,0},
  183.     {'Z',8, 3,6,3,3,3,3,3,0, 0,0,0,0,3,3,0,0, 0,0,0,3,3,0,0,0,
  184.             0,0,3,3,0,0,0,0, 3,6,3,3,3,3,3,0},
  185.     {'0',8, 0,6,3,3,3,3,0,0, 3,6,0,0,0,3,3,0, 3,6,0,3,0,3,3,0,
  186.             3,6,0,0,0,3,3,0, 0,6,3,3,3,3,0,0},
  187.     {'1',5, 3,3,3,0,0,0,0,0, 0,3,3,0,0,0,0,0, 0,3,3,0,0,0,0,0,
  188.             0,3,3,0,0,0,0,0, 3,3,3,3,0,0,0,0},
  189.     {'2',8, 3,3,6,3,3,3,0,0, 0,0,0,0,3,3,3,0, 3,3,6,3,3,3,0,0,
  190.             3,3,0,0,0,0,0,0, 3,3,6,3,3,3,3,0},
  191.     {'3',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 0,0,0,0,3,3,0,0,
  192.             3,3,6,0,0,3,3,0, 0,3,6,3,3,3,0,0},
  193.     {'4',8, 3,3,0,0,3,3,0,0, 3,3,0,0,3,3,0,0, 3,3,6,3,3,3,3,0,
  194.             0,0,0,0,3,3,0,0, 0,0,0,0,3,3,0,0},
  195.     {'5',8, 3,3,6,3,3,3,3,0, 3,3,0,0,0,0,0,0, 3,3,6,3,3,3,0,0,
  196.             0,0,0,0,0,3,3,0, 3,3,6,3,3,3,0,0},
  197.     {'6',8, 0,6,3,3,3,3,0,0, 3,6,0,0,0,0,0,0, 3,6,3,3,3,3,0,0,
  198.             3,6,0,0,0,3,3,0, 0,6,3,3,3,3,0,0},
  199.     {'7',8, 3,6,3,3,3,3,0,0, 0,0,0,0,0,3,3,0, 0,0,0,3,3,0,0,0,
  200.             0,0,3,3,0,0,0,0, 0,0,3,3,0,0,0,0},
  201.     {'8',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0,
  202.             3,3,0,0,0,3,3,0, 0,3,6,3,3,3,0,0},
  203.     {'9',8, 0,3,6,3,3,3,0,0, 3,3,0,0,0,3,3,0, 0,3,6,3,3,3,3,0,
  204.             0,0,0,0,0,3,3,0, 0,3,6,3,3,3,3,0},
  205.     {'_',7, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  206.             0,0,0,0,0,0,0,0, 0,3,6,3,3,3,0,0},
  207.     {'*',8, 0,3,0,6,0,3,0,0, 0,0,3,6,3,0,0,0, 3,3,3,6,3,3,3,0,
  208.             0,0,3,6,3,0,0,0, 0,3,0,6,0,3,0,0},
  209.     {'-',5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 3,6,3,3,0,0,0,0,
  210.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  211.     {'|',4, 0,3,3,0,0,0,0,0, 0,3,3,0,0,0,0,0, 0,3,3,0,0,0,0,0,
  212.             0,3,3,0,0,0,0,0, 0,3,3,0,0,0,0,0},
  213.     {'.',5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  214.             0,0,0,0,0,0,0,0, 0,3,6,3,0,0,0,0},
  215.     {'(',5, 0,0,6,3,0,0,0,0, 0,3,6,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  216.             0,3,6,0,0,0,0,0, 0,0,6,3,0,0,0,0},
  217.     {')',5, 0,3,5,0,0,0,0,0, 0,0,5,3,0,0,0,0, 0,0,0,3,3,0,0,0,
  218.             0,0,5,3,0,0,0,0, 0,3,5,0,0,0,0,0},
  219.     {'[',5, 0,3,6,3,0,0,0,0, 0,3,6,0,0,0,0,0, 0,3,6,0,0,0,0,0,
  220.             0,3,6,0,0,0,0,0, 0,3,6,3,0,0,0,0},
  221.     {']',5, 0,3,5,3,0,0,0,0, 0,0,5,3,0,0,0,0, 0,0,5,3,0,0,0,0,
  222.             0,0,5,3,0,0,0,0, 0,3,5,3,0,0,0,0},
  223.     {'/',7, 0,0,0,0,3,3,0,0, 0,0,0,3,3,0,0,0, 0,0,6,3,0,0,0,0,
  224.             0,3,6,0,0,0,0,0, 3,3,0,0,0,0,0,0},
  225.    {'\\',7, 0,3,3,0,0,0,0,0, 0,0,3,6,0,0,0,0, 0,0,0,6,3,0,0,0,
  226.             0,0,0,0,3,3,0,0, 0,0,0,0,0,3,3,0},
  227.     {' ',5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  228.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  229.      };
  230.  
  231.   static struct _b8x5 f3[] = {          // 7x4 robo-computer font
  232.     {'A',8, 0,3,2,2,2,3,0,0, 1,3,1,1,1,3,1,0, 3,3,0,0,0,0,3,0,
  233.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  234.     {'B',8, 3,2,2,2,2,3,0,0, 3,1,1,1,1,1,3,0, 3,3,0,0,0,0,3,0,
  235.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  236.     {'C',8, 3,2,2,2,2,2,3,0, 3,1,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  237.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  238.     {'D',8, 3,2,2,2,2,2,3,0, 3,1,0,0,0,0,3,0, 3,3,0,0,0,0,3,0,
  239.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  240.     {'E',8, 3,2,2,2,2,2,2,0, 3,1,1,1,1,1,1,0, 3,3,0,0,0,0,0,0,
  241.             3,3,1,1,1,1,1,0, 0,0,0,0,0,0,0,0},
  242.     {'F',8, 3,2,2,2,2,2,2,0, 3,1,1,1,1,1,1,0, 3,3,0,0,0,0,0,0,
  243.             3,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  244.     {'G',8, 3,2,2,2,2,2,3,0, 3,1,0,0,1,1,1,0, 3,3,0,0,0,0,3,0,
  245.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  246.     {'H',8, 3,0,0,0,0,0,3,0, 3,1,1,1,1,1,3,0, 3,3,0,0,0,0,3,0,
  247.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  248.     {'I',3, 3,0,0,0,0,0,0,0, 3,1,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  249.             3,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  250.     {'J',8, 0,0,0,0,0,3,0,0, 0,0,0,0,0,3,1,0, 0,0,0,0,0,3,3,0,
  251.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  252.     {'K',8, 3,0,0,0,3,0,0,0, 3,1,1,3,1,1,1,0, 3,3,0,0,0,0,3,0,
  253.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  254.     {'L',8, 3,0,0,0,0,0,0,0, 3,1,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  255.             3,3,1,1,1,1,1,0, 0,0,0,0,0,0,0,0},
  256.     {'M',8, 3,2,2,3,2,2,3,0, 3,1,0,3,0,0,3,0, 3,3,0,3,0,0,3,0,
  257.             3,3,0,3,0,0,3,0, 0,0,0,0,0,0,0,0},
  258.     {'N',8, 3,2,2,2,2,2,3,0, 3,1,0,0,0,0,3,0, 3,3,0,0,0,0,3,0,
  259.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  260.     {'O',8, 3,2,2,2,3,3,3,0, 3,0,0,0,0,2,3,0, 3,0,0,0,0,0,3,0,
  261.             3,1,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  262.     {'P',8, 3,2,2,2,2,2,3,0, 3,1,1,1,1,1,3,0, 3,3,0,0,0,0,0,0,
  263.             3,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  264.     {'Q',8, 3,2,2,2,2,2,3,0, 3,0,0,0,0,0,3,0, 3,0,0,0,0,0,3,0,
  265.             3,1,1,3,3,3,3,0, 0,0,0,0,0,0,0,0},
  266.     {'R',8, 3,2,2,2,2,3,0,0, 3,1,1,1,1,3,1,0, 3,3,0,0,0,0,3,0,
  267.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  268.     {'S',8, 3,2,2,2,2,2,3,0, 3,1,1,1,1,1,1,0, 0,0,0,0,0,3,3,0,
  269.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  270.     {'T',8, 2,2,2,3,2,2,2,0, 0,0,0,3,1,0,0,0, 0,0,0,3,3,0,0,0,
  271.             0,0,0,3,3,0,0,0, 0,0,0,0,0,0,0,0},
  272.     {'U',8, 3,0,0,0,0,0,3,0, 3,1,0,0,0,0,3,0, 3,3,0,0,0,0,3,0,
  273.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  274.     {'V',8, 3,3,0,0,0,0,3,0, 3,3,0,0,0,1,3,0, 0,3,0,0,0,3,0,0,
  275.             0,3,1,1,1,3,0,0, 0,0,0,0,0,0,0,0},
  276.     {'W',8, 3,0,0,3,0,0,3,0, 3,1,0,3,0,0,3,0, 3,3,0,3,0,0,3,0,
  277.             3,3,1,3,1,1,3,0, 0,0,0,0,0,0,0,0},
  278.     {'X',8, 3,0,0,0,0,0,3,0, 2,1,1,1,1,1,2,0, 3,3,0,0,0,0,3,0,
  279.             3,3,0,0,0,0,3,0, 0,0,0,0,0,0,0,0},
  280.     {'Y',8, 3,0,0,0,0,0,3,0, 3,1,1,1,1,1,3,0, 0,0,0,3,3,0,0,0,
  281.             0,0,0,3,3,0,0,0, 0,0,0,0,0,0,0,0},
  282.     {'Z',8, 2,2,2,2,2,2,3,0, 1,1,1,1,1,1,3,0, 3,3,0,0,0,0,0,0,
  283.             3,3,1,1,1,1,1,0, 0,0,0,0,0,0,0,0},
  284.     {'0',8, 3,2,2,2,2,2,3,0, 3,0,0,0,0,1,3,0, 3,0,0,0,0,3,3,0,
  285.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  286.     {'1',3, 0,3,0,0,0,0,0,0, 1,3,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,
  287.             3,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  288.     {'2',8, 3,2,2,2,2,2,3,0, 0,0,0,0,0,0,3,0, 3,3,2,2,2,2,2,0,
  289.             3,3,1,1,1,1,3,0, 0,0,0,0,0,0,0,0},
  290.     {'3',8, 3,2,2,2,2,3,0,0, 0,1,1,1,1,3,1,0, 0,0,0,0,0,3,3,0,
  291.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  292.     {'4',8, 3,0,0,0,0,3,0,0, 3,0,0,0,0,3,0,0, 3,1,1,1,1,3,1,0,
  293.             0,0,0,0,3,3,0,0, 0,0,0,0,0,0,0,0},
  294.     {'5',8, 3,2,2,2,2,2,2,0, 3,1,1,1,1,1,1,0, 0,0,0,0,0,3,3,0,
  295.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  296.     {'6',8, 3,2,2,2,2,2,3,0, 3,1,1,1,1,1,1,0, 3,0,0,0,0,3,3,0,
  297.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  298.     {'7',8, 2,2,2,2,2,2,3,0, 0,0,0,0,0,1,3,0, 0,0,0,0,0,3,3,0,
  299.             0,0,0,0,0,3,3,0, 0,0,0,0,0,0,0,0},
  300.     {'8',8, 0,3,2,2,2,3,0,0, 1,3,1,1,1,3,1,0, 3,0,0,0,0,3,3,0,
  301.             3,1,1,1,1,3,3,0, 0,0,0,0,0,0,0,0},
  302.     {'9',8, 3,2,2,2,2,2,3,0, 3,0,0,0,0,0,3,0, 2,2,2,2,2,3,3,0,
  303.             0,0,0,0,0,3,3,0, 0,0,0,0,0,0,0,0},
  304.     {'-',5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 3,3,3,3,0,0,0,0,
  305.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  306.     {' ',5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
  307.             0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0},
  308.       };
  309.  
  310.   static struct _b8x5 f4[] = {          // 7x4 reversed video FONT3
  311.     {'A',8, 3,2,2,2,2,2,3,3, 3,0,3,3,3,0,3,3, 0,0,1,1,1,1,0,3,
  312.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  313.     {'B',8, 2,2,2,2,2,2,3,3, 0,3,3,3,3,1,2,3, 0,0,1,1,1,1,0,3,
  314.             0,0,3,3,3,3,0,3, 1,1,1,1,1,1,1,3},
  315.     {'C',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,1,3, 0,0,3,3,3,3,3,3,
  316.             0,0,3,3,3,3,2,3, 1,1,1,1,1,1,1,3},
  317.     {'D',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,0,3,3,3,3,0,3,
  318.             0,0,3,3,3,3,0,3, 1,1,1,1,1,1,1,3},
  319.     {'E',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,3,3, 0,0,1,1,1,1,1,3,
  320.             0,0,3,3,3,3,3,3, 1,1,1,1,1,1,1,3},
  321.     {'F',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,3,3, 0,0,1,1,1,1,1,3,
  322.             0,0,3,3,3,3,3,3, 1,1,3,3,3,3,3,3},
  323.     {'G',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,1,3, 0,0,3,3,1,1,0,3,
  324.             0,0,3,3,3,3,0,3, 1,1,1,1,1,1,1,3},
  325.     {'H',8, 2,3,3,3,3,3,2,3, 0,3,3,3,3,3,0,3, 0,0,1,1,1,1,0,3,
  326.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  327.     {'I',3, 2,3,3,3,3,3,3,3, 0,3,3,3,3,3,3,3, 0,0,3,3,3,3,3,3,
  328.             0,0,3,3,3,3,3,3, 1,1,3,3,3,3,3,3},
  329.     {'J',8, 3,3,3,3,3,2,3,3, 3,3,3,3,3,0,3,3, 3,3,3,3,3,0,0,3,
  330.             2,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  331.     {'K',8, 2,3,3,3,2,3,3,3, 0,3,3,2,1,3,3,3, 0,0,1,1,1,1,0,3,
  332.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  333.     {'L',8, 2,3,3,3,3,3,3,3, 0,3,3,3,3,3,3,3, 0,0,3,3,3,3,3,3,
  334.             0,0,3,3,3,3,3,3, 1,1,1,1,1,1,1,3},
  335.     {'M',8, 2,2,2,2,2,2,2,3, 0,3,3,0,3,3,0,3, 0,0,3,0,3,3,0,3,
  336.             0,0,3,0,3,3,0,3, 1,1,3,1,3,3,1,3},
  337.     {'N',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,0,3,3,3,3,0,3,
  338.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  339.     {'O',8, 2,2,2,2,2,2,2,3, 0,3,3,3,1,0,0,3, 0,3,3,3,3,3,0,3,
  340.             0,3,3,3,3,3,0,3, 1,1,1,1,1,1,1,3},
  341.     {'P',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,0,1,1,1,1,1,3,
  342.             0,0,3,3,3,3,3,3, 1,1,3,3,3,3,3,3},
  343.     {'Q',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,3,3,3,3,3,0,3,
  344.             0,3,3,3,2,2,0,3, 1,1,1,1,1,1,1,3},
  345.     {'R',8, 2,2,2,2,2,2,3,3, 0,3,3,3,3,0,3,3, 0,0,1,1,1,1,0,3,
  346.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  347.     {'S',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,1,3, 1,1,1,1,1,0,0,3,
  348.             2,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  349.     {'T',8, 2,2,2,2,2,2,2,3, 3,3,3,0,3,3,3,3, 3,3,3,0,0,3,3,3,
  350.             3,3,3,0,0,3,3,3, 3,3,3,1,1,3,3,3},
  351.     {'U',8, 2,3,3,3,3,3,2,3, 0,3,3,3,3,3,0,3, 0,0,3,3,3,3,0,3,
  352.             0,0,3,3,3,3,0,3, 1,1,1,1,1,1,1,3},
  353.     {'V',8, 2,2,3,3,3,3,2,3, 0,0,3,3,3,3,0,3, 1,0,3,3,3,0,1,3,
  354.             3,0,3,3,3,0,3,3, 3,1,1,1,1,1,3,3},
  355.     {'W',8, 2,3,3,2,3,3,2,3, 0,3,3,0,3,3,0,3, 0,0,3,0,3,3,0,3,
  356.             0,0,3,0,3,3,0,3, 1,1,1,1,1,1,1,3},
  357.     {'X',8, 2,3,3,3,3,3,2,3, 0,3,3,3,3,3,0,3, 2,0,1,1,1,1,2,3,
  358.             0,0,3,3,3,3,0,3, 1,1,3,3,3,3,1,3},
  359.     {'Y',8, 2,3,3,3,3,3,2,3, 0,3,3,3,3,3,0,3, 1,1,1,0,0,1,1,3,
  360.             3,3,3,0,0,3,3,3, 3,3,3,1,1,3,3,3},
  361.     {'Z',8, 2,2,2,2,2,2,2,3, 3,3,3,3,3,3,0,3, 0,0,1,1,1,1,1,3,
  362.             0,0,3,3,3,3,3,3, 1,1,1,1,1,1,1,3},
  363.     {'0',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,3,3,3,3,0,0,3,
  364.             0,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  365.     {'1',3, 3,2,3,3,3,3,3,3, 3,0,3,3,3,3,3,3, 0,0,3,3,3,3,3,3,
  366.             0,0,3,3,3,3,3,3, 1,1,3,3,3,3,3,3},
  367.     {'2',8, 2,2,2,2,2,2,2,3, 1,3,3,3,3,3,0,3, 2,2,2,2,2,2,0,3,
  368.             0,0,3,3,3,3,2,3, 1,1,1,1,1,1,1,3},
  369.     {'3',8, 2,2,2,2,2,2,3,3, 1,3,3,3,3,0,3,3, 3,1,1,1,1,0,0,3,
  370.             2,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  371.     {'4',8, 2,3,3,3,3,2,3,3, 0,3,3,3,3,0,3,3, 0,3,3,3,3,0,3,3,
  372.             1,1,1,1,0,0,1,3, 3,3,3,3,1,1,3,3},
  373.     {'5',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,3,3, 1,1,1,1,1,0,0,3,
  374.             2,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  375.     {'6',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,1,3, 0,1,1,1,1,0,0,3,
  376.             0,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  377.     {'7',8, 2,2,2,2,2,2,2,3, 3,3,3,3,3,3,0,3, 3,3,3,3,3,0,0,3,
  378.             3,3,3,3,3,0,0,3, 3,3,3,3,3,1,1,3},
  379.     {'8',8, 3,2,2,2,2,2,3,3, 3,0,3,3,3,0,3,3, 0,1,1,1,1,0,0,3,
  380.             0,3,3,3,3,0,0,3, 1,1,1,1,1,1,1,3},
  381.     {'9',8, 2,2,2,2,2,2,2,3, 0,3,3,3,3,3,0,3, 0,2,2,2,2,2,0,3,
  382.             3,3,3,3,3,0,0,3, 3,3,3,3,3,1,1,3},
  383.     {'-',5, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 0,0,0,0,3,3,3,3,
  384.             3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3},
  385.     {' ',5, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,
  386.             3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3},
  387.       };
  388.  
  389.  
  390.   // NOTE: the font-table automatically adjusts to the variable number
  391.   //       of elements in the font definition array's!
  392.  
  393.   static struct _font_tab {             // font table structure
  394.          int  k;                        // (max) number of columns
  395.          int  r;                        // number of rows (lines)
  396.          int  n;                        // number of pattern entries
  397.          struct _b8x5 *d;               // pointer to font definition
  398.            } ft[] = {                   // FONT table
  399.          {0,0,0,NULL},                  // FONT0 dummy: suppress title
  400.          {6,3,sizeof(f1)/sizeof(struct _b8x5),f1}, // FONT1
  401.          {8,5,sizeof(f2)/sizeof(struct _b8x5),f2}, // FONT2
  402.          {8,4,sizeof(f3)/sizeof(struct _b8x5),f3}, // FONT3
  403.          {8,5,sizeof(f4)/sizeof(struct _b8x5),f4}, // FONT4
  404.            };
  405.  
  406.   static char a[80];                    // returned line buffer
  407.   static char b_array[]  = " ▄▀█░▌▐▒▓"; // block character elements
  408.                                         // codepage 437, 860, 863, 865
  409.   static char pg_multi[] = " ▄▀█░║║▒▓"; // Code Page 850: Multilingual
  410.  
  411.   if (c_info.codepage==850)            // codepage 850
  412.     strcpy(b_array,pg_multi);          // suitable blockchars
  413.  
  414.   if (f<FONT1 || f>FONT4)               // check range of selected font
  415.     f = FONT2;                          // reset to default if out of range
  416.  
  417.   if (k<LINE1 || k>ft[f].k-1)           // check range of LINE
  418.     k = LINE1;                          // prevent addressing violations
  419.  
  420.   i = 0;                                // zero count
  421.   w = 1;                                // width 1: leading char
  422.   while (i<n && b[i]!='\0' && w<=sizeof(a)) {   // limit width of output
  423.     for (j=0; j<ft[f].n &&
  424.               ft[f].d[j].c!=toupper(b[i]); j++);   // search char
  425.     if (j < ft[f].n) {                  // found
  426.       if (w + ft[f].d[j].k < sizeof(a)) {    // would it fit?
  427.         w += ft[f].d[j].k;              // add active columns + 1 blank
  428.         ++i;                            // accept character
  429.         }                               // endif
  430.       else
  431.         n = i;                          // indicate 'full'
  432.       }                                 // endif
  433.     else {                              // not found
  434.       if (w + ft[f].k < sizeof(a)) {    // would dummy fit?
  435.         w += ft[f].k;                   // add max columns + 1 blank
  436.         ++i;                            // accept character
  437.         }                               // endif
  438.       else
  439.         n = i;                          // indicate 'full'
  440.       }                                 // endif
  441.     }                                   // endif
  442.    n = i;                               // maximum # title characters
  443.  
  444.   a[0] = b_array[(f==FONT4) ? 3 : 0];   // leading character
  445.   for (i=0,w=1; i<n; ++i) {             // process string up till n
  446.     for (j=0; j<ft[f].n &&
  447.               ft[f].d[j].c!=(char)toupper(b[i]); j++);  // search
  448.     if (j < ft[f].n) {                  // char found
  449.       a[w++] = b_array[ft[f].d[j].p[k].c0];
  450.       if (ft[f].d[j].k > 1)
  451.         a[w++] = b_array[ft[f].d[j].p[k].c1];
  452.       if (ft[f].d[j].k > 2)
  453.         a[w++] = b_array[ft[f].d[j].p[k].c2];
  454.       if (ft[f].d[j].k > 3)
  455.         a[w++] = b_array[ft[f].d[j].p[k].c3];
  456.       if (ft[f].d[j].k > 4)
  457.         a[w++] = b_array[ft[f].d[j].p[k].c4];
  458.       if (ft[f].d[j].k > 5)
  459.         a[w++] = b_array[ft[f].d[j].p[k].c5];
  460.       if (ft[f].d[j].k > 6)
  461.         a[w++] = b_array[ft[f].d[j].p[k].c6];
  462.       if (ft[f].d[j].k > 7)
  463.         a[w++] = b_array[ft[f].d[j].p[k].c7];
  464.       }
  465.     else {                              // char not found
  466.       --j;                              // take last character in table
  467.       for (x=0; x<ft[f].k; x++)         // max columns
  468.         a[w++] = b_array[ft[f].d[j].p[0].c0];    // filler block
  469.       }                                 // endfor
  470.     }                                   // endfor
  471.   a[(f==FONT4) ? w : w-1] = '\0';       // end of string
  472.   return(a);                            // return ptr to outputstring
  473.   }
  474.