home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / LASER / BFONT513.ZIP / HEXFONT.BFC < prev    next >
Encoding:
Text File  |  1989-01-28  |  5.5 KB  |  136 lines

  1. N,"Hex Font G";
  2.  t:cn="(c) Copyright 1988,1989 Bruce J. Patin 12/28/88, 01/23/89";
  3. {  Format for each character is "@ cc ch cw df yd pw hexdata",
  4.    where @ starts the character, and cc, ch, cw, df, yd, p are decimal:
  5.          cc = character code,
  6.          ch = character height,
  7.          cw = character width,
  8.          df = 1, 2 or 3, to select format:
  9.               1 if data is in CRT format,
  10.               2 if in Wire Matrix format,
  11.               3 if in Wire Matrix, separated by passes,
  12.          yd = number of passes,
  13.          pw = number of wires used for multi-pass printing,
  14.          hexdata = the character bit data in hexadecimal characters.
  15.  
  16.          The above items may be separated by spaces, commas,
  17.          or carriage return/line feeds, as desired.
  18.  
  19.          It is important to make sure there are enough bytes
  20.          of hexdata for the selected values of height, width, etc.
  21.          If some other method than BitFont is used to generate
  22.          the data, it would be wise to add extra 00's to the
  23.          end of the data just in case.
  24. }
  25. { following are default assignments:}
  26.   x: df=1;      {init data format to 1}
  27.   x: xd=1;      {double horizontal density. Does not affect character
  28.                  data, merely the displayed density of dots.}
  29.   x: yd=1;      {one pass, normal vertical density}
  30.   x: pw=8;      {number of print wires used if multi-pass printing}
  31.   x: to=15;     {offset of character top to baseline.
  32.                  This does not affect character data in this configuration, merely display of baseline.
  33.                  unless, perhaps, you use the Normalize function.}
  34.   x: lo=0;      {left offset, ignore it}
  35.   x: cw=16;     {default character width}
  36.   x: ch=16;     {default character height}
  37.   a: aa=1;      {allow adjacent dots}
  38.   a: fw=cw;     {maximum font cell width, for Normalize function}
  39.   a: fh=ch;     {max font cell height, for Normalize}
  40.   a: bl=to;     {position of baseline relative to top of font cell.}
  41.  
  42. E; {end initialization section.}
  43.  
  44. Ki1,"Load font"; {start input font.}
  45. #:**,"Using Hex Font G to load font";
  46. z 12:fs-fp;     {will cause jump to L12 if end of file is reached}
  47. L 88;
  48. #:**,"Searching for @ character";
  49. L 8;            {start of loop to get each character}
  50.   u: zz;        {read a byte}
  51. j 8: zz,ne,64; {look for @ sign (decimal 64) to start character}
  52.   d: cc;        {character code in decimal}
  53. L 1; {label 1 to indicate start of character.}
  54. #  : cc,"Loading code (decimal) ";
  55.   d: ch;     {character height, in decimal}
  56.   d: cw;     {character width, in decimal}
  57.   d: df;     {1, 2 or 3, to select format}
  58.   d: yd;     {number of passes}
  59.   d: pw;     {number of wires used for multi-pass printing}
  60.   gh;        {character data, represented in hex}
  61. ESL; {end character search, character loaded.}
  62. # : cc,"Loaded code (decimal) ";
  63. j 88;        {go get next char}
  64. L 12; {end of file reached}
  65. #  : **,"Loaded.";
  66.  
  67. Ei1,2,0; {end load font.}
  68.  
  69. KS; {start search for an input character.}
  70. j 12:fp,ge,fs;  {L12 is end of file reached}
  71. L 9;            {start loop to search}
  72.   u: zz;        {read a byte}
  73. j 9: zz,ne,64; {look for @ sign to start character}
  74.   d: zc;        {character code in decimal}
  75. #: zc,"Encountered code (decimal): ";
  76. #: fp,"At file position: ";
  77. j 9: zc,ne,cc; {check to see if it's the one you want}
  78. # : cc,"Found code (dec)";
  79.   j 1;           {found, go get it}
  80. L 10;       {char not found}
  81. ESU; {end character search program (unsuccessful search)}
  82.  
  83. ko1,"Save font."; {start output font }
  84.                {following lines select characters to output}
  85.   a:cc=0;      {start with first possible code, zero}
  86.   c;           {select first valid code}
  87. j 57;          {bypass first check to see if cc is back to zero}
  88. L 55;          {jumped here to get next code}
  89.   c;           {select first valid code}
  90. j 59:cc,eq,0;  {go to 59 if no more valid codes (cc is back to zero)}
  91. L 57;          {valid code selected}
  92.  
  93. KC;            {start output character.}
  94. #  : cc,"Sending code (decimal): ";
  95.   y:"@ ";  {indicate start of a character}
  96.    d: cc,4; {decimal code of character, followed by a space}
  97.   d: ch,4; {decimal value of height}
  98.   d: cw,4; {decimal value of width}
  99.   d: df,4; {decimal value of format}
  100.   d: yd,4; {decimal value of number of passes}
  101.   d: pw,4; {decimal value of number of wires}
  102.   w: $0d0a;    {output a carriage return, line feed}
  103.  
  104. {***********}
  105. {the following loop to output data could be replaced, and
  106.  greatly sped up, by simply coding:
  107.   gh;
  108.  however, the data bytes would not be separated for easy reading.}
  109.   a: zz=0;        {using zz to count data bytes}
  110. L 77;             {start of loop to output a byte}
  111. j 78:zz+32,gt,dl; {check to see that at least 32 bytes are left}
  112.   gh:zz,32;       {output 32 data bytes in hex characters}
  113.   a: zz=zz+32;    {increment count}
  114. j 79;             {jump around next gh}
  115. L 78;
  116.   gh:zz,dl-zz;    {output remainder of data if less than 32 bytes}
  117.   a: zz=dl;       {now have output dl bytes}
  118. L 79;
  119.   w: $0d0a;       {output a carriage return, line feed}
  120. j 77:zz,lt,dl;    {go output another byte, if count is less than data length}
  121. {***********}
  122.   w: $0d0a;    {output a carriage return, line feed}
  123.  
  124.  
  125. EC; {end output character.}
  126. a:cc=cc+1;     {increment to next code}
  127. j 55;          {jump to select it, or next higher valid code}
  128. L 59;          {all characters have been written}
  129.  
  130. Eo1; {end save font.}
  131.  
  132. KP; {start download}
  133. #   :**,"This font can not be downloaded in its present form.";
  134. EP; {end download}
  135. .
  136.