home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / WINDOWS / TOOLS / FCG / PCLDRV.PRG < prev    next >
Text File  |  1993-12-01  |  24KB  |  606 lines

  1. *****************************************************************************
  2. *   This file contains all the printer driver routines. These routines
  3. *   are called by the functions that FormCode/Gen generates for your design
  4. *   namely FCGFIXOBJ, FIXVAROBJ, etc. There are two ways these routines can
  5. *   be made accesible to these procedures:
  6. *       1) By appending them to the file that contains the generated code.
  7. *          FormCode/Gen does this for you if you select the Append Procedures
  8. *          From PCLDRV option from the Page Setup dialog box.
  9. *       2) By making these routines accesible to the generated procedures by
  10. *          issuing a SET PROCEDURE TO. This is what FormCode/Gen does if you
  11. *          do not check the Append Procedures From PCLDRV check box.
  12. *
  13. *   NOTE: The routines in this library can be called directly by code that you
  14. *   write yourself also. To do this, make sure you call FCGSTART before any
  15. *   other routines and call FCGEND after printing is done. You will also
  16. *   need to declare the following global variables (use the PUBLIC statement):
  17. *       FCGRSTVAR, FCGGTOVAR, FCGLINVAR, FCGRCTVAR, FCGMOVVAR, FCGEXTVAR
  18. *  The best way to hand write code is to use generated code as a starting point.
  19. *****************************************************************************
  20.  
  21. *****************************************************************************
  22. *   Function: Initializes printer and sets up job paramets. Must be called
  23. *          before the start of a job
  24. *   Parameters: fcgcopies - (numeric) number of copies (1-99)
  25. *           fcgorient - (numeric) sheet orientation. 0 means portrait,
  26. *                one means landscape
  27. *        fcgsize - (numeric) paper size. Must be one of the following:
  28. *            1 for Executive Size (7 1/4 x 10 1/2 in)
  29. *            2 for Letter Size (8 1/2 x 11 in)
  30. *            3 for Legal Size (8 1/2 x 14 in)
  31. *               26 for A4 Size (210mm x 297mm)
  32. *               80 for Monarch Size Envelope (3 7/8 x 7 1/2 in)
  33. *               81 for COM 10 Size Envelope (4 1/8 x 9 1/2 in)
  34. *               90 for DL Size Envelope (110mm x 220mm)
  35. *               91 for C5 Size Envelope (162mm 229mm)
  36. *        fcgbin - (numeric) paper bin to use. Must be one of the following:
  37. *            1 for Upper Tray
  38. *            2 for Manual Feed
  39. *            3 for Manual Envelope Feed
  40. *            4 for Lower Tray
  41. *            5 for Paper Deck
  42. *            6 for Envelope Feeder
  43. *        fcgres - (numeric) Raster Graphics Resolution (Dots Per Inch)
  44. *            Must be one of the following values:
  45. *            75, 100, 150, 300
  46. *****************************************************************************
  47. procedure fcgstart
  48. parameters fcgcopies,fcgorient,fcgsize,fcgbin,fcgres
  49.  
  50. ?? chr(27)+"E"+chr(27)+"&l"+ltrim(str(fcgcopies))+"x"+ ;
  51.    ltrim(str(fcgorient))+"o"+ltrim(str(fcgsize))+"a4d1e42f"+ ;
  52.    ltrim(str(fcgbin))+"h"+ltrim(str(fcgres))+"R"
  53. ?? chr(27)+"*v1O"
  54. return
  55.  
  56.  
  57. *****************************************************************************
  58. *   Function: End the job by resetting the printer.
  59. *****************************************************************************
  60. procedure fcgend
  61. ?? chr(27)+"E"
  62. return
  63.  
  64.  
  65. *****************************************************************************
  66. *   Function: Sets the public variable FCGGTOVAR to PCL cursor position
  67. *             command to move cursor to specified coordinate position.
  68. *          Coordinates are specified in hundredths of inches, and point 0,0
  69. *          corresponds to the upper left corner of the physical page.
  70. *   Parameters: fcgx,fcgy - (numeric) cursor position
  71. *****************************************************************************
  72. procedure fcggoto
  73. parameters fcgx, fcgy
  74.  
  75. fcggtovar =  chr(27)+"*p"+ltrim(str(3*fcgx-75))+"x"+ltrim(str(3*fcgy-75))+"Y"
  76. return
  77.  
  78.  
  79. *****************************************************************************
  80. *   Function: Sets the public variable FCGMOVVAR to PCL cusror position command
  81. *             to move the PCL cursor horizontaly by specified relative ammount.
  82. *          Coordinates are specified in hundredths of inches, and point 0,0
  83. *          corresponds to the upper left corner of the physical page.
  84. *   Parameters: fcgx, - (numeric) ammount to move cursor by
  85. *****************************************************************************
  86. procedure fcgmovby
  87. parameters fcgx
  88.  
  89. fcgmovvar =  chr(27)+"*p+"+ltrim(str(3*fcgx))+"X"
  90. return
  91.  
  92.  
  93. *****************************************************************************
  94. *   Function: Calculates extent of text based on font metric information.
  95. *             Stores the calculated value in public variable FCGEXTVAR
  96. *   Parameters: fcgfntl,fcgfntu - (character) font metric arrays (upper/lower)
  97. *               fcgfntf - (numeric) first character in character set
  98. *               fcgstr - (character) the character string
  99. *   NOTE: The font metric information is generated by FormCode/Gen for fonts
  100. *   that need this information.
  101. *****************************************************************************
  102. procedure fcgtxtext
  103. parameters fcgfntl, fcgfntu, fcgfntf, fcgstr
  104. private fcglen, fcgidx, fcgchidx
  105.  
  106. fcgextvar = 0
  107. fcgidx = 1
  108. fcglen = len(fcgstr)
  109. do while fcgidx <= fcglen
  110.     fcgchidx = asc(substr(fcgstr,fcgidx,1)) - fcgfntf + 1
  111.     fcgextvar = fcgextvar + asc(substr(fcgfntl,fcgchidx,1)) + ;
  112.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  113.     fcgidx = fcgidx + 1
  114. *    @0,0 say fcgfntf+chr(fcgchidx+fcgfntf-1)+fcgextvar
  115. *    suspend
  116. enddo
  117. fcgextvar = int(fcgextvar / 10)
  118. return
  119.  
  120.  
  121. *****************************************************************************
  122. *   Function: Draws a verticle or horizontal line between specified points.
  123. *          Coordinates are specified in hundredths of inches, and point 0,0
  124. *          corresponds to the upper left corner of the physical page. Line
  125. *          coordinates specify center line for thick lines.
  126. *   Parameters: fcgx1,fcgy1 - (numeric) line starting position
  127. *        fcgx2,fcgy2 - (numeric) line ending position
  128. *        fcgthick - (numeric) line width in hundredths of inches
  129. *   NOTE: The ending position must specify coordinates that are larger than
  130. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  131. *****************************************************************************
  132. procedure fcgline
  133. parameters fcgx1, fcgy1, fcgx2, fcgy2, fcgthick
  134. private fcgposx,fcgposy,fcgsizex,fcgsizey,fcgtmp
  135.  
  136. if fcgx1 = fcgx2
  137.     fcgposx = fcgx1 - int(fcgthick/2)
  138.     fcgposy = fcgy1
  139.     fcgsizex = fcgthick
  140.     fcgsizey = fcgy2 - fcgy1 + 1
  141. else
  142.     fcgposy = fcgy1 - int(fcgthick/2)
  143.     fcgposx = fcgx1
  144.     fcgsizey = fcgthick
  145.     fcgsizex = fcgx2 - fcgx1 + 1
  146. endif
  147.  
  148. do fcggoto with fcgposx,fcgposy
  149. ?? fcggtovar+chr(27)+"*c"+ltrim(str(3*fcgsizex))+"a" + ;
  150.    ltrim(str(3*fcgsizey))+"b0P"
  151. return
  152.  
  153.  
  154. *****************************************************************************
  155. *   Function: Draws a rectangle with or without a border and with or without a
  156. *             fill. Coordinates are specified in hundredths of inches, and
  157. *             point 0,0 corresponds to the upper left corner of the physical page.
  158. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  159. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  160. *        fcgthick - (numeric) border width in hundredths of inches
  161. *        fcgfillt - (numeric) fill type. Must be one of the following:
  162. *            0 for black fill
  163. *            1 for white fill
  164. *            2 for HP defined gray shading pattern
  165. *            3 for HP defined cross-hatched pattern
  166. *                       4 for no fill
  167. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  168. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  169. *            for fcgfillt = 2, a gray shading percentage value from
  170. *            the following (2,10,15,30,45,70,90,100)
  171. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  172. *                       to the six predefined patterns.
  173. *   NOTE: The ending position must specify coordinates that are larger than
  174. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  175. *****************************************************************************
  176. procedure fcgrect
  177. parameters fcgleft,fcgtop,fcgright,fcgbot,fcgthick,fcgfillt,fcgfillp
  178.  
  179. if fcgfillt <> 4
  180.     do fcggoto with fcgleft, fcgtop
  181. ?? fcggtovar+chr(27)+"*c"+ltrim(str(fcgfillp))+"g"+;
  182.    ltrim(str((fcgright-fcgleft+1)*3))+"a"+ltrim(str((fcgbot-fcgtop+1)*3))+"b"+;
  183.    ltrim(str(fcgfillt))+"P"
  184. endif
  185.  
  186. if fcgthick > 0
  187.     do fcgline with fcgleft,fcgtop,fcgright,fcgtop,fcgthick
  188.     do fcgline with fcgleft,fcgbot,fcgright,fcgbot,fcgthick
  189.     do fcgline with fcgleft,fcgtop-int(fcgthick/2),fcgleft, ;
  190.             fcgbot+int((fcgthick-1)/2),fcgthick
  191.     do fcgline with fcgright,fcgtop-int(fcgthick/2),fcgright, ;
  192.             fcgbot+int((fcgthick-1)/2),fcgthick
  193. endif
  194. return
  195.  
  196.  
  197. *****************************************************************************
  198. *   Function: Draws a box with specified border width, type, sahdow, etc.
  199. *          Coordinates are specified in hundredths of inches, and point 0,0
  200. *          corresponds to the upper left corner of the physical page.
  201. *   Parameters: fcgleft,fcgtop - (numeric) upper left corner coordinates
  202. *        fcgright,fcgbot - (numeric) lower left corner coordinates
  203. *        fcgthick - (numeric) border width in hundredths of inches
  204. *        fcgfillt - (numeric) fill type. Must be one of the following:
  205. *            0 for black fill
  206. *            1 for white fill
  207. *            2 for HP defined gray shading pattern
  208. *            3 for HP defined cross-hatched pattern
  209. *                       4 for no fill
  210. *        fcgfillp - (numeric) the fill pattern. Value depends upon the
  211. *            value of fcgfillt (ignored for fcgfillt = 0 or 1)
  212. *            for fcgfillt = 2, a gray shading percentage value from
  213. *            the following (2,10,15,30,45,70,90,100)
  214. *            for fcgfillt = 3, a number between 1 and 6 corresponding
  215. *                       to the six predefined patterns.
  216. *        fcgborder - (numeric) if = 0, specifies a single border. If = 1
  217. *            specifies a double border.
  218. *        fcgshadow - (numeric) if = 0, specifies no shadow. If = 1
  219. *            specifies a shadow.
  220. *   NOTE: The ending position must specify coordinates that are larger than
  221. *      or equal to start cordinates (i.e x2 >= x1, and y2 >= y1)
  222. *****************************************************************************
  223. procedure fcgbox
  224. parameters fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgbfillt, ;
  225.     fcgbfillp, fcgbborder, fcgbshadow
  226. private fcgbmargin,fcgft
  227.  
  228. fcgft = fcgbfillt
  229. fcgbmargin = 2 * fcgbthick
  230. if fcgbborder = 1
  231.     do fcgrect with fcgbleft+fcgbmargin, fcgbtop+fcgbmargin, fcgbright-fcgbmargin, ;
  232.     fcgbbot-fcgbmargin, fcgbthick, fcgft, fcgbfillp
  233.     fcgft = 4
  234. endif
  235.  
  236. do fcgrect with fcgbleft, fcgbtop, fcgbright, fcgbbot, fcgbthick, fcgft, fcgbfillp
  237.  
  238. if fcgbshadow = 1
  239.     do fcgrect with fcgbleft+5-int(fcgbthick/2), fcgbbot+int(fcgbthick/2), ;
  240.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  241.     do fcgrect with fcgbright+int(fcgbthick/2), fcgbtop+5-int(fcgbthick/2), ;
  242.     fcgbright+5+int(fcgbthick/2), fcgbbot+5+int(fcgbthick/2), 1, 0, 0
  243. endif
  244. return
  245.  
  246.  
  247. *****************************************************************************
  248. *   Function: Prints left justified text at specified position
  249. *   Parameters:
  250. *    fcgfnts - (character) Font selection string
  251. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  252. *    fcgtext - (numeric) The text string to print
  253. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  254. *                           parametrs are interpreted the same as in FCGBOX
  255. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  256. *****************************************************************************
  257. procedure fcgltxt
  258. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp
  259.  
  260. if len(fcgtext) = 0
  261.     return
  262. endif
  263.  
  264. do fcggoto with fcgtlft, fcgttop
  265. ?? fcgfnts
  266. if (fcgfillt <> 0)
  267.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  268. endif
  269. ?? fcggtovar+fcgtext
  270. if (fcgfillt <> 0)
  271.    ?? chr(27)+"*v0T"
  272. endif
  273. return
  274.  
  275.  
  276. *****************************************************************************
  277. *   Function: Prints L/R justified single line text at specified position
  278. *   Parameters:
  279. *    fcgfnts - (character) Font selection string
  280. *    fcgtlft,fcgttop - (numeric) Position of first character in string
  281. *    fcgtext - (numeric) The text string to print
  282. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  283. *                            parametrs are interpreted the same as in FCGBOX
  284. *    fcgbrkxtra - (numeric) The break extra ammount to spread in breaks
  285. *    fcgbrkcnt - (numeric) The number of break characters in string
  286. *    fcgbrkch - (numeric) The actual break character for symbol set
  287. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  288. *****************************************************************************
  289. procedure fcglrstxt
  290. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, ;
  291.     fcgbrkxtra, fcgbrkcnt, fcgbrk
  292. private fcgbrkamt, fcgbrkrm, fcgstpos, fcgtmpstr, fcgbrkch, fcgamt, fcgcurch
  293. private fcgstrlen
  294.  
  295. if len(fcgtext) = 0
  296.     return
  297. endif
  298.  
  299. fcgbrkch = chr(fcgbrk)
  300. if fcgbrkcnt <> 0
  301.     fcgbrkamt = int(fcgbrkxtra/fcgbrkcnt)
  302.     fcgbrkrm = int(fcgbrkxtra - (fcgbrkamt * fcgbrkcnt))
  303. endif
  304. fcgstrlen = len(fcgtext)
  305. fcgstpos = 1
  306. do fcggoto with fcgtlft, fcgttop
  307. fcgtmpstr = fcgfnts+fcggtovar
  308. do while fcgstpos <= fcgstrlen
  309.     fcgcurch = substr(fcgtext,fcgstpos,1)
  310.     if fcgcurch = fcgbrkch
  311.         fcgamt = fcgbrkamt
  312.     if fcgbrkrm > 0
  313.         fcgamt = fcgamt + 1
  314.         fcgbrkrm = fcgbrkrm - 1
  315.     endif
  316.         if fcgamt > 0
  317.         do fcgmovby with fcgamt
  318.         endif
  319.     endif
  320.     if fcgcurch = fcgbrkch .AND. fcgamt > 0
  321.         fcgtmpstr = fcgtmpstr + fcgcurch + fcgmovvar
  322.     else
  323.         fcgtmpstr = fcgtmpstr + fcgcurch
  324.     endif
  325.     fcgstpos = fcgstpos + 1
  326. enddo
  327. if (fcgfillt <> 0)
  328.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  329. endif
  330. ?? fcgtmpstr
  331. if (fcgfillt <> 0)
  332.    ?? chr(27)+"*v0T"
  333. endif
  334. return
  335.  
  336. *****************************************************************************
  337. *   Function: Prints multi line L/R justified dynamic text at specified position
  338. *   Parameters:
  339. *    fcgfnts - (character) Font selection string
  340. *    fcgtlft, fcgttop - (numeric) center position of string
  341. *    fcgtext - (numeric) The text string to print
  342. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  343. *                           parameters are interpreted the same as in FCGBOX
  344. *       fcgfntl, fcgfntu - (character) text metric arrays
  345. *       fcgfntf - (numeric) first character position in character set
  346. *       fcgfnth - (numeric) font height
  347. *       fcgfntbrk - (numeric) ascii value of the font break character
  348. *       fcgextent - (numeric) text extent in hundredths of inches
  349. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  350. *****************************************************************************
  351. procedure fcglrtxt
  352. parameters fcgfnts, fcgtlft, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  353.     fcgfntu, fcgfntf, fcgfnth, fcgfntbrk, fcgextent
  354. private fcgcurpos, fcgendpos, fcgtmp, fcgword, fcgstrlen, fcgcurch, fcgbrkch
  355. private fcgcurext, fcgwrdext, fcgchidx, fcgbrkext, fcgspxtra, fcgbrkcnt, fcgdone, ;
  356.         fcglinend
  357.  
  358. if len(fcgtext) = 0
  359.     return
  360. endif
  361.  
  362. fcgcurpos = 1
  363. fcgcurext = 0
  364. fcgbrkcnt = 0
  365. fcgextent = fcgextent * 10
  366. fcgtmp = ""
  367. fcgstrlen = len(fcgtext)
  368. fcgbrkch = chr(fcgfntbrk)
  369. fcgdone = .F.
  370. fcgbrkext = asc(substr(fcgfntl,fcgfntbrk-fcgfntf+1,1)) + ;
  371.         (asc(substr(fcgfntu,fcgfntbrk-fcgfntf+1,1))-1) * 256
  372. ?? fcgfnts
  373. if (fcgfillt <> 0)
  374.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  375. endif
  376. do while .T.
  377. *    suspend
  378.     do while fcgcurpos <= fcgstrlen
  379.         fcgcurch = substr(fcgtext,fcgcurpos,1)
  380.         if fcgcurch <>  fcgbrkch
  381.             exit
  382.         endif
  383.         fcgcurpos = fcgcurpos + 1
  384.     enddo
  385.     fcgendpos = fcgcurpos
  386.     fcgwrdext = 0
  387.     do while fcgendpos <= fcgstrlen
  388.         fcgcurch = substr (fcgtext,fcgendpos,1)
  389.         if fcgcurch = fcgbrkch .OR. fcgcurch = chr(13) .OR. fcgcurch = chr(10)
  390.             exit
  391.         endif
  392.         fcgchidx = asc(fcgcurch) - fcgfntf + 1
  393.         fcgwrdext = fcgwrdext + asc(substr(fcgfntl,fcgchidx,1)) + ;
  394.         (asc(substr(fcgfntu,fcgchidx,1))-1) * 256
  395.         fcgendpos = fcgendpos + 1
  396.     enddo
  397.     if fcgcurext = 0
  398.         fcgspxtra = 0
  399.     else
  400.         fcgspxtra = fcgbrkext
  401.     endif
  402.     if (fcgcurext + fcgwrdext + fcgspxtra <= fcgextent) .OR. ;
  403.         (fcgcurext = 0 .AND. fcgwrdext >= fcgextent)
  404.         if fcgcurext <> 0
  405.             fcgtmp = fcgtmp + fcgbrkch
  406.             fcgbrkcnt = fcgbrkcnt + 1
  407.             fcgcurext = fcgcurext + fcgbrkext
  408.         endif
  409.         fcgtmp = fcgtmp + substr(fcgtext,fcgcurpos,fcgendpos-fcgcurpos)
  410.         if fcgcurch = chr(10) .OR. fcgcurch = chr(13)
  411.             fcglinend = .T.
  412.         else
  413.             fcglinend = .F.
  414.         endif
  415. *        @3, 5 say fcgtmp + "    CurCh["+fcgcurch+"]"
  416. *        suspend
  417.         fcgcurext = fcgcurext + fcgwrdext
  418.         fcgcurpos = fcgendpos + 1
  419.         if fcgcurch = chr(13) .AND. fcgcurpos <= fcgstrlen .AND. substr(fcgtext,fcgcurpos,1) = chr(10)
  420.             fcgcurpos = fcgcurpos + 1
  421.         endif
  422.     else
  423.         fcglinend = .F.
  424.         fcgdone = .T.
  425.     endif
  426.     if fcgcurext >= fcgextent .OR. fcglinend .OR. fcgcurpos > fcgstrlen .OR. fcgdone
  427. *        clear
  428. *        @4,5 say fcgtmp
  429. *        @6,5 say str(fcgextent,6)+str(fcgcurext,6)+str(fcgbrkcnt,6)
  430. *        @7,5 say "CurCh["+fcgcurch+"]  Pos: "+str(fcgcurpos,4)+"  Len: "+str(fcgstrlen,4)
  431. *        suspend
  432.         if fcgcurpos > fcgstrlen .OR. fcglinend
  433.         do fcgltxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0
  434.     else
  435.         do fcglrstxt with "", fcgtlft, fcgttop, fcgtmp, 0, 0, ;
  436.             (fcgextent-fcgcurext)/10, fcgbrkcnt, fcgfntbrk
  437.         endif
  438.         fcgdone = .F.
  439.         fcgcurext = 0
  440.         fcgtmp = ""
  441.         fcgbrkcnt = 0
  442.         fcgttop = fcgttop + fcgfnth
  443.         if fcgcurpos > fcgstrlen
  444.             exit
  445.         endif
  446.     endif
  447. if (fcgfillt <> 0)
  448.    ?? chr(27)+"*v0T"
  449. endif
  450. enddo
  451.  
  452.  
  453. *****************************************************************************
  454. *   Function: Prints center justified text at specified position
  455. *   Parameters:
  456. *    fcgfnts - (character) Font selection string
  457. *    fcgtcnt, fcgttop - (numeric) center position of string
  458. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  459. *                           parameters are interpreted the same as in FCGBOX
  460. *    fcgtext - (numeric) The text string to print
  461. *       fcgfntl, fcgfntu - (character) text metric arrays
  462. *       fcgfntf - (numeric) first character position in character set
  463. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  464. *****************************************************************************
  465. procedure fcgctxt
  466. parameters fcgfnts, fcgtcnt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  467.     fcgfntu, fcgfntf
  468. private fcgtmp
  469.  
  470. if len(fcgtext) = 0
  471.     return
  472. endif
  473.  
  474. fcgtmp = trim(fcgtext)
  475. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  476. fcgtcnt = fcgtcnt - fcgextvar/2
  477. do fcggoto with fcgtcnt, fcgttop
  478. ?? fcgfnts
  479. if (fcgfillt <> 0)
  480.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  481. endif
  482. ?? fcggtovar+fcgtmp
  483. if (fcgfillt <> 0)
  484.    ?? chr(27)+"*v0T"
  485. endif
  486. return
  487.  
  488. *****************************************************************************
  489. *   Function: Prints right justified text at specified position
  490. *   Parameters:
  491. *    fcgfnts - (character) Font selection string
  492. *    fcgtrt, fcgttop - (numeric) center position of string
  493. *       fcgfillt,fcgfillp - (numeric) the pattern to use to draw text. These
  494. *                           parameters are interpreted the same as in FCGBOX.
  495. *    fcgtext - (numeric) The text string to print
  496. *       fcgfntl, fcgfntu - (character) text metric arrays
  497. *       fcgfntf - (numeric) first character position in character set
  498. *   NOTE: PCL printer will place the baseline at fcgttop (not cell top)
  499. *****************************************************************************
  500. procedure fcgrtxt
  501. parameters fcgfnts, fcgtrt, fcgttop, fcgtext, fcgfillt, fcgfillp, fcgfntl, ;
  502.     fcgfntu, fcgfntf
  503. private fcgtmp
  504.  
  505. if len(fcgtext) = 0
  506.     return
  507. endif
  508.  
  509. fcgtmp = trim(fcgtext)
  510. do fcgtxtext with fcgfntl, fcgfntu, fcgfntf, fcgtmp
  511. fcgtrt = fcgtrt - fcgextvar
  512. do fcggoto with fcgtrt, fcgttop
  513. ?? fcgfnts
  514. if (fcgfillt <> 0)
  515.     ?? chr(27)+"*c"+ltrim(str(fcgfillp))+"G"+chr(27)+"*v"+ltrim(str(fcgfillt))+"T"
  516. endif
  517. ?? fcggtovar+fcgtmp
  518. if (fcgfillt <> 0)
  519.    ?? chr(27)+"*v0T"
  520. endif
  521. return
  522.  
  523. *****************************************************************************
  524. *   Function: Defines printer macro with specified ID
  525. *   Parameters:
  526. *    fcgmacid - (character) macro id
  527. *****************************************************************************
  528. procedure fcgdefmac
  529. parameters fcgmacid
  530. ?? chr(27)+"&f"+fcgmacid+"y0X"
  531. return
  532.  
  533. *****************************************************************************
  534. *   Function: Ends definition for a printer macro
  535. *   Parameters: none
  536. *****************************************************************************
  537. procedure fcgendmac
  538. ?? chr(27)+"&f1X"
  539. return
  540.  
  541. *****************************************************************************
  542. *   Function: Executes printer macro with last ID
  543. *   Parameters: none
  544. *****************************************************************************
  545. procedure fcgdomac
  546. parameters fcgmacid
  547. ?? chr(27)+"&f2X"
  548. return
  549.  
  550. *****************************************************************************
  551. *   Function: Draws check box at specified location
  552. *   Parameters: fcgleft, fcgtop (numeric) top left corner of box
  553. *               fcgcheck (logical) check box checked or not ?
  554. *****************************************************************************
  555. procedure fcgchkbox
  556. parameters fcgleft, fcgtop, fcgcheck
  557. do fcgrect with fcgleft, fcgtop, fcgleft+15, fcgtop+15, 1, 4, 0
  558. if .NOT. fcgcheck
  559.     return
  560. endif
  561.  
  562. do fcggoto with fcgleft+1, fcgtop+1
  563. fcgbitmap = fcggtovar+chr(27)+"*t75R"+chr(27)+"*r11t11s1A"+chr(27)+"*b0M"
  564. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  565. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  566. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  567. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  568. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  569. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(4)
  570. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(8+2)
  571. fcgbitmap = fcgbitmap + chr(27)+"*b1W" + chr(16+1)
  572. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(32) + chr(128)
  573. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(64) + chr(64)
  574. fcgbitmap = fcgbitmap + chr(27)+"*b2W" + chr(128) + chr(32)
  575. ?? fcgbitmap+chr(27)+"*rB"
  576. return
  577.  
  578.  
  579. *****************************************************************************
  580. *   Function: Draws bitmap image at specified position
  581. *   Parameters: fcgleft, fcgtop (numeric) top left corner of image
  582. *               fcgname (character) name of bitmap file (must be in curr dir)
  583. *   WARNING: This function uses the DOS COPY command (with the /b switch for
  584. *   binary data) to copy the bitmap file to the printer. On systems other than
  585. *   DOS (e.g Novel, Unix, etc) this needs to be changed. Also the file is
  586. *   copied to standard printer PRN. If your printer is connected to a different
  587. *   port you need to change this also !!!
  588. *****************************************************************************
  589. procedure fcgimage
  590. parameters fcgleft, fcgtop, fcgname
  591.  
  592. * The following lines are dummy lines. They must be deleted by the user.
  593. * Their only porpose is to serve as a reminder for the new user
  594. *clear
  595. *@12, 10 say "PCLDRV.PRG has not been modified as described in the users manual."
  596. *@13, 10 say "Please read the section on Printing Bitmaps to acomplish this."
  597. *return
  598.  
  599. do fcggoto with fcgleft, fcgtop
  600. ?? fcggtovar
  601. * The next line should be changed so that it copies the file &fcgname to
  602. * your printer port. The copy command works for DOS but may need to be
  603. * changed for other systems such as Unix, Novel, etc.
  604. run copy /b &fcgname prn
  605. return
  606.