home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / LASER / BFONT513.ZIP / PROPRINT.BFC < prev    next >
Encoding:
Text File  |  1989-02-02  |  6.7 KB  |  186 lines

  1. n,"IBM ProPrinter";  {for BitFont 5.1 and up}
  2. t:cn="(c) Copyright 1988,1989 Bruce J. Patin 12-21-88, 02-01-89";
  3. {IBM and ProPrinter are trademarks of the
  4. International Business Machines Corporation}
  5.  
  6. {To create valid ProPrinter characters with BitFont, note the following:
  7. - Character height and width must always be: CH=8, CW=11.
  8. - An 8-dot high character normally uses the top 8 wires of the
  9.   print head.  A character may be shifted down to use the bottom 8
  10.   wires of the print head.  The downshift is indicated in BitFont
  11.   by changing the "TO.Top Offset" parameter from 7 to 6.
  12.   This will result in sending an "attribute" of 1 to the printer.
  13.   When you change the top offset, the location of the baseline
  14.   will change on the design screen.  This is for reference only.
  15. - Don't use the N-Normalize function on the design screen,
  16.   unless you want to fix up every downshifted character again
  17.   and change CH back to 8 for every character.
  18. - Don't worry about the character count.  BitFont will count them. Also,
  19.   any gaps in character codes will be filled in with blank characters.
  20. }
  21. {initialize BitFont specific variables}
  22.   a: aa=1;      {allow adjacent dots. Only necessary to disallow for certain wire matrix printers.}
  23.   x: df=2;      {init data format to 2, Wire Matrix}
  24.   x: xd=2;      {double horizontal density}
  25.   x: yd=1;      {single vertical density}
  26.   x: pw=8;      {8 print wires used in data}
  27.   x: cw=11;     {max character width}
  28.   x: ch=8;      {max character height}
  29.   x: lo=0;      {always 0}
  30.   x: to=7;      {7=normal, 6=downshifted character}
  31.   a: fw=11;     {max character width for whole font}
  32.   a: fh=9;      {this is the actual font height, including downshifting}
  33.   a: bl=7;      {marks bottom line of un-down-shifted character}
  34.   x: or=0;      {always 0}
  35. {you could also initialize the color variables in here, if desired}
  36.  
  37. a: d8=0;   {d8=0 during font save to file, d8=1 for downloading}
  38. e; {end initialization section.}
  39. a: zt=0; {will get no font trailer message if not loading entire font}
  40.  
  41. KI; {start input font header.}
  42.  
  43.  {a little re-initialization first}
  44.   a: aa=1;      {allow adjacent dots. Only necessary to disallow for certain wire matrix printers.}
  45.   x: df=2;      {init data format to 2, Wire Matrix}
  46.   x: xd=2;      {single horizontal density}
  47.   x: yd=1;      {single vertical density}
  48.   x: pw=8;      {8 print wires used in data}
  49.   x: cw=11;     {max character width}
  50.   x: ch=8;      {max character height}
  51.   x: lo=0;      {always 0}
  52.   x: to=7;      {7=normal, 6=downshifted character}
  53.   a: fw=11;     {max character width for whole font}
  54.   a: fh=9;      {this is the actual font height, including downshifting}
  55.   a: bl=7;      {marks bottom line of un-down-shifted character}
  56.   x: or=0;      {always 0}
  57.  
  58.   a: zt=1; {used to suppress no font trailer message}
  59. #:**, "Loading Font Header ";
  60.   L 2;
  61.   u: za;
  62.   j 2: za,ne,$1b; {look for esc}
  63.   u: zb;
  64.   j 2: zb,ne,$3d; {look for = }
  65.   ws: ct;  {count, number of bytes in font}
  66.   z 3:ct;  {start length limit for count, end load when done}
  67.   u: zz;   {throw away byte decimal 20}
  68.   u: fc;   {first character code}
  69.   a: lc=ct-2/13+fc-1; {calculate last character code}
  70. $:fc,"First Character code is (hex): ";
  71. $:lc,"Last Character code is (hex): ";
  72. #:**,"Hit return to continue";
  73. EI; {end input font header.}
  74.   a:cc=fc; {start with first code}
  75. j 1;       {first time, jump around code increment}
  76. L 2; {start of code increment}
  77. j 3:cc,eq,lc; {end load when code is last code}
  78.   a:cc=cc+1;  {increment code}
  79. L1; {label 1 to indicate start of character.}
  80. $ : cc,"Loading code (hex) ";
  81.   u: sa; {load the shift attribute}
  82.   a: to=7-sa; {translate shift attribute into top offset}
  83.   u: zz; {throw away the null byte}
  84.   g;  {get the character bit data}
  85. ESL; {end character search, character loaded.}
  86.   j 2;  {go get next char}
  87. L 3;
  88.   r;  {reset length limit}
  89. #:**,"Font loaded.";
  90. ET; {end input font.}
  91. KS; {start search for an input character.}
  92.   L 12;
  93.   u: za;
  94.   j 12: za,ne,$1b; {look for esc}
  95.   u: zb;
  96.   j 12: zb,ne,$3d; {look for = }
  97.   ws: ct;  {count, number of bytes in font}
  98.   u: zz;   {throw away space}
  99.   u: fc;   {first character code}
  100.   a: lc=ct-2/13+fc-1; {calculate last character code}
  101. j 10:cc,lt,fc; {if code is less than first code, not found}
  102. j 10:cc,gt,lc; {if code is greater than last code, not found}
  103. # : cc,"Loading code: ";
  104.   j 1;    {found, go get it}
  105.   L 10;       {char not found}
  106. ESU; {end character search program (unsuccessful search)}
  107. KO; {start output font header.}
  108. L 88; {for download}
  109. #:**, "Finding first and last codes for font header information.";
  110.   {starting to find first and last character codes}
  111.   a:cc=32; {start with one less than ProPrinter first valid code}
  112.   c; {select first valid code}
  113.   a:fc=cc; {save first code in fc}
  114. j 22:fc,eq,0; {error if no valid code}
  115. j 23:fc,gt,126; {error if first code value too high}
  116. L 21;  {loop to find last code}
  117.   a:lc=cc;  {set lc to last valid code selected}
  118.   a:cc=cc+1; {increment to next possible code}
  119.   c;  {select next code}
  120. j 24:cc,gt,126; {stop if higher than decimal 126}
  121. j 21:cc,ne,0; {loop if haven't reached last valid code}
  122. L 24;
  123.   a:ct=lc-fc+1*13+2;  {calculate count}
  124.   u:$1b; {escape}
  125.   u:$3d; {=}
  126.   ws:ct; {count, bytes swapped}
  127.   u:20;  {decimal code 20, per ProPrinter specs}
  128.   u:fc;  {first code}
  129. j 25;
  130. L 22; #:**,"ERROR: No valid code of value 21 (hex) or greater.";
  131. j 99;
  132. L 23; #:**,"ERROR: No valid code less than or equal to 126 (hex).";
  133. j 99;
  134. L 25; {end font descriptor output}
  135. EO; {end output font header.}
  136. a:kk=fc;  {start with first code}
  137. KC; {start output character}
  138. L 31;
  139. $ :kk,"Sending code (hex): ";
  140.   a:cc=kk; {set code for selection}
  141.   c; {select the code}
  142. j 32:cc,eq,kk; {if valid, go output it, otherwise output blank character}
  143.   u:$00; {attribute}
  144.   u:$00,12; {blank character}
  145. j 33;
  146. L 32; {start output a valid character}
  147. {make sure character data is decimal 13 bytes}
  148.   a:df=2;
  149.   a:yd=1;
  150.   a:cw=11;
  151.   a:ch=8;
  152.   x:pw=8;
  153.   {start to make sure top offset is 7 or 6}
  154. j 34:to,gt,7;
  155. j 34:to,lt,6;
  156. j 35;
  157. L 34;
  158.   a:to=7;
  159. L 35;
  160.   u:to-7; {convert top offset into attribute}
  161.   u:$00; {send a null byte}
  162.   g;     {character data}
  163. L 33;
  164. EC; {end output character.}
  165. a:kk=kk+1;
  166. j 31:kk,le,lc; {loop until sent last code}
  167. j 89:d8,eq,1; {go finish download if downloading}
  168. EZ; {end output font.}
  169. KP; {start download}
  170.   a:d8=1;  {downloading indicator}
  171. j 88;  {go save font to the printer}
  172. L 89; {now select the downloaded font}
  173.   a:d8=0; {turn off download indicator}
  174. L 81;
  175. #A:nn,"Enter 4 for normal quality, or 6 for NLQ: ";
  176. j 81:nn,eq,5;
  177. j 81:nn,lt,4;
  178. j 81:nn,gt,6;
  179.   u:27;
  180.   u:73;
  181.   u:nn;
  182. #:**," Font loaded and selected.";
  183. EP; {end download}
  184. L 99; {error exit}
  185. .
  186.