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

  1. n,"Canon Bubble Jet 36x48 font with HP LaserJet Conversion";
  2. t:cn="(c) Copyright 1989, Bruce J. Patin, 01-24-89, 02-01-89";
  3.   {this configuration file will only work with BitFont 5.1 and up}
  4.  
  5. {initialize font parameters}
  6.   a: aa=1; {allow adjacent dots}
  7.   a: oo=0,"";{font orientation always portrait}
  8.   a: bl=36,"";{baseline doesn't really matter, not used}
  9.   a: fw=36,"";{font cell width always 36}
  10.   a: fh=48,"";{font cell height always 48}
  11.  
  12. {initialize character parameters}
  13.   x: cc=0; {code}
  14.   x: df=2,""; {data format always 2, wire matrix}
  15.   x: pw=48,""; {print wires always 48, but actually no matter if df<>3}
  16.   x: xd=1,""; {single horizontal density}
  17.   x: yd=1,""; {single vertical density}
  18.   x: or=0,""; {orientation always portrait}
  19.   x: lo=0,""; {left offset must always be zero}
  20.   x: to=36,"Baseline Indicator"; {used for baseline display only}
  21.   x: cw=36,""; {character width always 36}
  22.   x: ch=48,""; {character height always 48}
  23.   {these two are Canon variables:}
  24.   x: sp=0, "Starting Position (0<=sp<=35)";
  25.   x: ep=36,"Ending Position   (1<=ep<=36)";
  26.  
  27. e; {end initialization section.}
  28.  
  29. Ki1,"Load a Canon 36x48 font.";
  30.   a: c1=0; {c1=0 for whole font, c1=1 for one character}
  31. L21; {starting point for loading single character}
  32.   a: zz=0; {general use}
  33.   a: zc=0; {current code in sequence}
  34.   a: zl=0; {last code in sequence}
  35.   a: nn=0; {nn is count of data bytes in sequence}
  36.   a: zy=0; {zy = 0 says code sequence not found yet}
  37.   {some re-initialization, in case parms were messed up by operator}
  38.   a: aa=1; {allow adjacent dots}
  39.   a: oo=0,"";{font orientation always portrait}
  40.   a: fw=36,"";{font cell width always 36}
  41.   a: fh=48,"";{font cell height always 48}
  42.   x: df=2,""; {data format always 2, wire matrix}
  43.   x: pw=48,""; {print wires always 48}
  44.   x: or=0,""; {orientation always portrait}
  45.   x: lo=0,""; {left offset must always be zero}
  46.   x: cw=36,""; {character width always 36}
  47.   x: ch=48,""; {character height always 48}
  48.   {the above values will actually become effective when a G is executed}
  49. Z2:fs; {jump to label 2 if eof reached}
  50. #:fs,"Searching for code sequence.  Filesize is ";
  51. L1; {search for code sequence}
  52. #:fp,"File position ";
  53.   u:zz;
  54.   j1:zz,ne,$1c;
  55.   u:zz;
  56.   j1:zz,ne,$43;
  57.   u:zz;
  58.   j1:zz,ne,$44;
  59.   a:zy=1; {found a code sequence}
  60.   ws:nn; {count, low byte first}
  61.   u:zc;  {first code of sequence}
  62.   a:zl=nn-1/218-1+zc; {last code to load in this sequence}
  63. L4; {start of character}
  64.   J1:zc,gt,zl; {if last code reached, go look for another sequence}
  65. j25:c1,eq,0; {skip next check if loading whole font}
  66. j22:zc,ne,c2; {if one character load, and not the one, go skip}
  67. L25;
  68.   a: cc=zc;    {code}
  69. $:zc,"Loading code (hex) ";
  70.   u: sp;       {at1, starting position}
  71.   u: ep;       {at2, ending position}
  72.   g;           {bit-map data}
  73. J24: c1,eq,1;  {if was one character load, did it, go end it}
  74. L23; {return from skip by load character proc}
  75.   a: zc=zc+1;  {next code}
  76. j4; {end of character}
  77. L2; {end of file}
  78. j3:zy,eq,0;
  79. Ei1,2,0; {successful load, display code selection, delete 00 if not loaded.}
  80. L3; {no code sequence found}
  81. #R:**,"No code sequence found.  Not a Canon 36x48 font.  Hit return.";
  82. Ei1; {unsuccessful load}
  83.  
  84. Ki2,"Load current character from a Canon font.";
  85.   a: c1=1; {set for single character load}
  86.   a: c2=cc; {one code to load}
  87. j21;
  88. L22; {here to skip a character if not the one wanted}
  89. $:zc,"Skipping code (hex) ";
  90.   P,fp+218; {position file past character}
  91. J23; {go back for more}
  92. L24; {character loaded}
  93. ei2,1; {end and display design screen}
  94.  
  95. ko1,"Save as a Canon 36x48 font.";
  96. a: p1=0; {p1=0 says saving font to file, p1=1 says downloading}
  97. L91; {here for downloading}
  98. #:**, "Finding first and last codes for data count calculation.";
  99.   {starting to find first and last character codes}
  100.   a:cc=0; {start with 0}
  101.   c; {select first valid code}
  102.   a:fc=cc; {save first code in fc}
  103. L 71;  {loop to find last code}
  104.   a:lc=cc;  {set lc to last valid code selected}
  105.   a:cc=cc+1; {increment to next possible code}
  106.   c;  {select next code}
  107. j 72:cc,gt,127; {stop if higher than decimal 127}
  108. j 71:cc,ne,0; {loop if haven't reached last valid code}
  109. L 72;
  110.   a:nn=lc-fc+1*218+1;  {calculate data count}
  111. u:$1c; {send font header}
  112. u:$43;
  113. u:$44;
  114. ws:nn;
  115. u:fc;
  116. a: zc=fc; {current code being sent}
  117. L11;
  118. c,zc; {select a code}
  119. j73:ee,eq,0; {if no error, was valid, skip over blank output}
  120. $:zc,"Sending blank for code (hex): ";
  121. u:0; {at1}
  122. u:36; {at2}
  123. u:0,216; {output 216 zeros}
  124. j12; {go do next code after blank}
  125. L73; {for skipping over blank output}
  126. $:cc,"Sending code (hex): ";
  127. {check to see that parms are still as required. If not, fix them.}
  128. j13:ch,ne,48;
  129. j13:cw,ne,36;
  130. j13:df,ne,2;
  131. j14; {ok so far}
  132. L13; {needs changing, use macro to do it}
  133. v,2,36,48,48; {sets format 2, width 36, height 48, wires 48}
  134. L14;
  135. j15:sp,lt,0;
  136. j15:sp,gt,35;
  137. j16;
  138. L15;
  139. a:sp=0; {set sp to zero if invalid}
  140. L16;
  141. j17:ep,lt,1;
  142. j17:ep,gt,36;
  143. j18;
  144. L17;
  145. j19:ep,gt,sp;
  146. a:ep=36;
  147. L19;
  148. a:ep=36-sp; {set ep to its max value if invalid}
  149. L18;
  150. u:sp;
  151. u:ep;
  152. g;
  153. L12; {increment to next code}
  154. a:zc=zc+1;
  155. J11:zc,le,lc; {go for more unless last code done}
  156. j92: p1,eq,1;  {if downloading, go back to select downloaded font}
  157. eo1;
  158.  
  159. kp; {download proc}
  160.   a: p1=1; {set for download}
  161. j91; {go do it}
  162. L92; {downloaded, now select ram cg}
  163.   u:27; {escape}
  164.   u:37; { % }
  165.   u:1;
  166. #:**,"Font downloaded, RAM CG selected.";
  167. ep; {finished and ram cg selected}
  168.  
  169. Ki3,"Load an HP Font as Canon, resizing proportionately.";
  170.   a: c1=0; {c1=0 for whole font, c1=1 for one character}
  171.   a: c3=1; {c3=0 used to indicate unsuccessful load of one character}
  172. L51; {entry from single character load, with resizing}
  173.   a:aw=30; a:ah=30; a:bw=36; a:bh=36; {resize parms}
  174.   t:dm="nad";  {normalize, resize rel to b}
  175. L41; {here from font load, no resize}
  176. L61; {entry from single character load, no resizing}
  177. {initialize as necessary}
  178.   a: zz=0; {general use}
  179.   a: zc=0; {current code in sequence}
  180.   a: zy=0; {zy = 0 says HP font descriptor sequence not found yet}
  181.   a: aa=1; {allow adjacent dots}
  182.   a: oo=0,"";{font orientation always portrait}
  183. #:fs,"Searching for HP font descriptor in file, size: ";
  184. L31; {start of search for font descriptor}
  185. #:fp,"File position: ";
  186.   u:zz;
  187.   J31: zz,ne,$1b; {look for esc}
  188.   u: zz;
  189.   j31: zz,ne,$29; {look for ) }
  190.   u: zz;
  191.   j31: zz,ne,$73;  {look for s }
  192.   a: zy=1; {found an HP Font descriptor}
  193.   d: zl;      {escape sequence main data length}
  194.   u: zz;      {throw away term char}
  195.   w: fd;      {font descriptor size}
  196.   u: zz;      {reserved}
  197.   u: zz;      {Font type}
  198.   w: zz;      {reserved}
  199.   w: bl; {Baseline Distance (dots)}
  200.   w: fw; {Cell Width (dots)}
  201.   w: fh; {Cell Height (dots)}
  202.   p:fp+fd-12; {skip to end of font descriptor}
  203. L32;  {start search for code definition}
  204. j34: fp,gt,fs; {don't look for more if eof}
  205.   u: zz;
  206.   j32: zz,ne,$1b; {look for esc}
  207.   u: zz;
  208.   j32: zz,ne,$2a; {look for * }
  209.   u: zz;
  210.   j32: zz,ne,$63;  {look for c }
  211.   d: cc;      {decimal code of character}
  212.   u: zz;      {throw away term char}
  213. L33; {search for character descriptor}
  214.   u: zz;
  215.   j 33: zz,ne,$1b; {look for esc}
  216.   u: zz;
  217.   j 33: zz,ne,$28; {look for ( }
  218.   u: zz;
  219.   j 33: zz,ne,$73;  {look for c }
  220.   d: zl;      {length of character descriptor and data}
  221. j36:c1,eq,0; {skip next check if loading whole font}
  222. j36:cc,eq,c2; {skip next skip if its the one you want}
  223. $ : cc,"Skipping code (hex) ";
  224. p:fp+1+zl; {skip termchar, and length of descriptor and data}
  225. j32; {go look at next character}
  226. L36;
  227. $ : cc,"Loading code (hex) ";
  228.   p:fp+5;  {skip termchar, format, cont, size, class}
  229.   u: or;  {Character Orientation}
  230.   u: zz;  {reserved}
  231.   i: lo;  {left offset}
  232.   i: to;  {top offset}
  233.   w: cw;  {character width}
  234.   w: ch;  {character height}
  235.   i: ep;  {endpoint}
  236.   a: ep=ep*bw/aw/4; {convert to Canon Ending Position}
  237.   a: xl=zl-14-2; {bit-map data length}
  238.   a: df=1;
  239.   g:0,xl; {character data}
  240. $ : cc,"Converting code (hex) ";
  241.   m; {execute macro to normalize and maybe resize}
  242.   v,2,36,48,48; {sets format 2, width 36, height 48, wires 48}
  243. j 32:c1,eq,0; {go get another, unless you only wanted one}
  244.   a:c3=1; {says got the character wanted}
  245. L34; {end of file}
  246.   a:fw=36;
  247.   a:fh=48;
  248.   a:bl=bl*bh/ah;
  249. j35:zy,eq,0;
  250. j37:c3,eq,0;
  251. Ei3,2,0; {successful load, display code selection, delete 00 if not loaded.}
  252. Ei4,2,0; {successful load, display code selection, delete 00 if not loaded.}
  253. Ei5,1; {successful load, display design screen.}
  254. Ei6,1; {successful load, display design screen.}
  255. L35; {no code sequence found}
  256. #R:**,"No HP Font Descriptor found.  Not an HP font.  Hit return.";
  257.   a:cc=c2; {to make sure original code and data are selected.}
  258.   c:c2;
  259. Ei3; {unsuccessful load}
  260. Ei4; {unsuccessful load}
  261. L37; {can't find character}
  262. #R:**,"Current code not found in input file.  Hit return.";
  263.   a:cc=c2; {to make sure original code and data are selected.}
  264.   c:c2;
  265. Ei5; {unsuccessful load}
  266. Ei6; {unsuccessful load}
  267.  
  268. Ki4,"Load an HP Font as Canon, dot for dot.";
  269.   a:aw=36; a:ah=48; a:bw=36; a:bh=48; {resize parms}
  270.   t:dm="n";  {normalize only, no resize}
  271.   a: c0=0; {c1=0 for whole font, c1=1 for one character}
  272.   a: c3=1; {c3=0 used for single character load unsuccessful}
  273. j41;
  274.  
  275. Ki5,"Load current character from HP font, resizing proportionately.";
  276.   a:aw=36; a:ah=48; a:bw=36; a:bh=48; {resize parms}
  277.   t:dm="nad";  {normalize, resize rel to b}
  278.   a: c1=1; {c1=0 for whole font, c1=1 for one character}
  279.   a: c2=cc;
  280.   a: c3=0; {will be set to 1 if found code}
  281. j51;
  282.  
  283. Ki6,"Load current character from HP font, dot for dot.";
  284.   t:dm="n";  {normalize only, no resize}
  285.   a: c1=1; {c1=0 for whole font, c1=1 for one character}
  286.   a: c2=cc;
  287.   a: c3=0; {will be set to 1 if found code}
  288. j61;
  289. .
  290.