📄 ps.prg
字号:
*:*********************************************************************
*:
*: Procedure file: C:\PRO20\PDRIVERS\PS.PRG
*:
*: System: FoxPro Printer Driver Application
*: Author: MCP
*: Copyright (c) 1991, Fox Holdings, Inc.
*: Last modified: 07/05/91 12:51
*:
*: Procs & Fncts: CHK_SPECIAL
*:
*: Documented 07/09/91 at 09:27 FoxDoc version 2.10
*: Impelmeded patch for intl. characters for PS incl. Sectionmark
*: by MarkusK 12/07/92 16:39
*:*********************************************************************
*!*********************************************************************
*!
*! Procedure: PDONLOAD
*!
*!*********************************************************************
PROCEDURE PDonload
_pdparms[39] = _pdparms[39] + 1
RETURN
*!*********************************************************************
*!
*! Procedure: PDONUNLOAD
*!
*!*********************************************************************
PROCEDURE PDonunload
IF _pdparms[39] = 1
RELEASE _pdparms
ELSE
_pdparms[39] = _pdparms[39] - 1
ENDIF
RETURN
*!*********************************************************************
*!
*! Procedure: PDDOCST
*!
*!*********************************************************************
PROCEDURE PDdocst
PARAMETER doc_height, doc_width
PRIVATE m.code1, m.code2, m.code3, m.code4, m.code5, m.code6, m.code7, m.ctlchars, m.leading, ;
m.lineext, m.trans_x, m.trans_y, m.valof9, m.valof21
*
* Build the Postscript program which will handle the printing of the
* report. This includes procedures which control how lines, pages,
* styles, and line characters are handled.
*
*
* Set docuement values for the document height and width, super and subscript
* values, and scaling factors.
*
m.valof21 = VAL(_pdparms[21])
STORE ALLTRIM(STR(;
MIN((_pdparms[36] - (_pdparms[11] * 2)) / doc_width, ;
(_pdparms[37] - (_pdparms[7] * 2)) / doc_height),7,4)) TO ;
_pdparms[9]
m.valof9 = VAL(_pdparms[9])
m.leading = _pdparms[4] /m.valof21
_pdparms[19] = ALLTRIM(STR(_pdparms[22]/m.valof9, 4, 1))
_pdparms[20] = ALLTRIM(STR(_pdparms[23]/m.valof9, 4, 1))
_pdparms[34] = m.valof21 / m.valof9
IF (_pdparms[34] + m.leading) > 1
m.lineext = ALLTRIM(STR(_pdparms[34] + m.leading - 1,4,3))
ELSE
m.lineext = "0"
ENDIF
_pdparms[3] = ALLTRIM(STR(_pdparms[34],7,4))
header ="%!PS-Adobe-1.0" + CHR(13) + ;
"%%Creator: FoxPro Postscript driver, Version 1.0" + CHR(13) + ;
"%%Title:" + CHR(13) + ;
"%%Creation Date: " + DTOC(DATE()) + " " + TIME() + CHR(13)
*
* Code1 will contain Postscript code for formfeeds, new lines, displaying an object,
* and resetting of the font to the default font.
*
m.code1 = "/ff {outputflag 0 ne {showpage} if" + CHR(13) + ;
" setupsave restore" + CHR(13) + ;
" /setupsave save def " + CHR(13) + ;
" 0 linepos moveto" + CHR(13) + ;
" /lineno 0 def} def" + CHR(13) + ;
"/nl {newpath linepos " + ALLTRIM(STR(_pdparms[10] * _pdparms[34])) + " lt" + CHR(13) + ;
" {ff}" + CHR(13) + ;
" {lineno " + ALLTRIM(STR(m.doc_height)) + " ge {ff} {/linepos linepos lineheight sub def} ifelse}" + CHR(13) + ;
" ifelse" + CHR(13) + ;
" /lineno lineno 1 add def" + CHR(13) + ;
" 0 linepos moveto} def" + CHR(13) + ;
"/say { show" + CHR(13) + ;
" /outputflag 1 def} def" + CHR(13) + ;
"/norm {" + _pdparms[18] + " findfont " + CHR(13) + ;
" " + _pdparms[3] + " scalefont setfont} def" + CHR(13) + ;
"/rmt {rmoveto} def" + CHR(13) + ;
"/xy {/objx cp pop def /objy cp exch pop def} def" + CHR(13) + ;
"/mtxy {objx objy moveto} def" + CHR(13) + ;
"/slw {0 setlinewidth} def" + CHR(13)
*
* Code2 will contain the Postscript code for pushing the currentpoint on the stack,
* moving to a point on the page, changing the font, manipulating the stack, and
* underlining an object. Some of these are one command procedures which is done in
* order to minimize the output of the printer driver.
*
m.code2 = "/trim {{( ) anchorsearch {pop} {exit} ifelse} loop} def" + CHR(13) + ;
"/strw {dup length /strwidth exch def} def" + CHR(13) + ;
"/numwidth {dup stringwidth pop strwidth exch sub} def" + CHR(13) + ;
"/jfy {strw trim numwidth} def" + CHR(13) + ;
"/rj {jfy 0 rmt xy} def" + CHR(13) + ;
"/ctr {jfy 2 div 0 rmt xy} def" + CHR(13) + ;
"/cp {currentpoint} def" + CHR(13) + ;
"/mt {moveto} def" + CHR(13) + ;
"/font {findfont exch scalefont setfont} def" + CHR(13) + ;
"/rol {cp 3 -1 roll} def" + CHR(13) + ;
"/mv {rol exch mt pop} def" + CHR(13) + ;
"/up {rol add mt} def" + CHR(13) + ;
"/dn {rol sub mt} def" + CHR(13) + ;
"/u1 {xy 0 " + _pdparms[3] + " -.1 mul rmt} def" + CHR(13) + ;
"/u2 {dup stringwidth" + CHR(13) + ;
" " + ALLTRIM(STR(_pdparms[34] * .04, 3,2)) + " setlinewidth" + CHR(13) + ;
" rlineto gsave stroke grestore" + CHR(13) + ;
" mtxy slw say} def" + CHR(13)
*
* Code3 - Code7 contain the Postscript code to handle the graphical characters in
* range of ASCII 179 to 218. Each character is handled sepearately.
*
m.code3 = "/gcp {mt 1 0 rmt} def" + CHR(13) + ;
"/l1 {dup 0 le {" + m.lineext + " sub} {" + ;
m.lineext + " add} ifelse 0 exch rlineto} def" + CHR(13) + ;
"/l2 {0 rlineto} def" + CHR(13) + ;
"/dhl {0 .4 rmt l2 0 .2 rmt l2} def" + CHR(13) + ;
"/dvl {.4 0 rmt l1 .2 0 rmt l1} def" + CHR(13) + ;
"/lm {rol 0 rmt} def" + CHR(13) + ;
"/ulc {mt cp 0 .6 rmt .4 l2 .4 l1} def" + CHR(13) + ;
"/blc {mt cp 0 .4 rmt .4 l2 -.4 l1} def" + CHR(13) + ;
"/urc {mt cp 1 .6 rmt -.4 l2 .4 l1} def" + CHR(13) + ;
"/brc {mt cp 1 .4 rmt -.4 l2 -.4 l1} def" + CHR(13) + ;
"/trc {mt cp 0 .6 rmt .6 l2 -.6 l1} def" + CHR(13) + ;
"/lrc {mt cp 0 .4 rmt .6 l2 .6 l1} def" + CHR(13) + ;
"/tlc {mt cp 1 .4 rmt -.6 l2 .6 l1} def" + CHR(13)
m.code4 = "/llc {mt cp 1 .6 rmt -.6 l2 -.6 l1} def" + CHR(13) + ;
"/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -