home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a036 / 6.ddi / DRIVERS.EXE / POSTSCRI.DLD < prev    next >
Encoding:
Text File  |  1993-03-16  |  16.8 KB  |  673 lines

  1. 
  2. % /* $$$
  3. %     64673 Borlandized
  4. %    $$$ */
  5. %
  6. % ctrl-D to clear any hanging input
  7. %
  8. % dBASE IV Postscript Download File (Postscri.dld)
  9. % Copyright 1989,1991 Borland International, Inc.
  10. % $Log:$
  11. % version 1.12
  12. %
  13. % --------- User-adjustable parameters -------
  14. % default page size & orientation
  15. /paper 1 def      % (1=letter, 2=legal, 3=A4)
  16. /orient 1 def     % (1=portrait, 2=landscape)
  17. /nLPP 66 def      % lines per page (60, 66, 78, or 88 for portrait;
  18.                   %                 45 for landscape)
  19. % printer-dependent portrait offsets
  20. /tpxoff 18 def    % x (letter)
  21. /tpyoff 28 def    % y (letter)
  22. /gpxoff 22 def    % x (legal)
  23. /gpyoff 26 def    % y (legal)
  24. /apxoff 16 def    % x (A4)
  25. /apyoff 18 def    % y (A4)
  26. % printer-dependent landscape offsets
  27. /tlxoff 18 def    % x (letter)
  28. /tlyoff 44 def    % y (letter)
  29. /glxoff 18 def    % x (legal)
  30. /glyoff 80 def    % y (legal)
  31. /alxoff  0 def    % x (A4)
  32. /alyoff 29 def    % y (A4)
  33. % point sizes to use
  34. /PicaPoint 12 def                            % Pica
  35. /ElitePoint 10 def                           % Elite
  36. /CompressedPoint 8 def                       % compressed
  37. /CurPoint PicaPoint def                      % initial pointsize
  38. % fonts to use
  39. /CurFSet 1 def                               % default font set
  40. /FSet {
  41.          /CurFSet exch def
  42.          % Font Set 1 (default)
  43.          /n       /Courier-Foreign def                        % normal
  44.          /b       /Courier-Bold-Foreign def                   % bold
  45.          /i       /Courier-Oblique-Foreign def                % italic
  46.          /bi      /Courier-BoldOblique-Foreign def            % bold+italic
  47.          CurFSet 2 eq
  48.                   {
  49.                   /n       /Helvetica-Foreign def
  50.                   /b       /Helvetica-Bold-Foreign def
  51.                   /i       /Helvetica-Oblique-Foreign def
  52.                   /bi      /Helvetica-BoldOblique-Foreign def
  53.                   } if
  54.          CurFSet 3 eq
  55.                   {
  56.                   /n       /Times-Roman-Foreign def
  57.                   /b       /Times-Bold-Foreign def
  58.                   /i       /Times-Italic-Foreign def
  59.                   /bi      /Times-BoldItalic-Foreign def
  60.                   } if
  61.          /FontNorm n def
  62.          /FontBold b def
  63.          /FontItal i def
  64.          /FontBoldItal bi def
  65.          Norm
  66.    } def
  67. % --------- End User-adjustable parameters -------
  68. % ------ User-callable macros
  69. /Letter  {/paper 1 def OrientPaper} def      % Set Letter
  70. /Legal   {/paper 2 def OrientPaper} def      % Set Legal
  71. /A4      {/paper 3 def OrientPaper} def      % Set A4
  72. /Port    {/orient 1 def OrientPaper} def     % Set Portrait
  73. /Land    {/orient 2 def OrientPaper} def     % Set Landscape
  74. /60LPP   {60 LPP} def
  75. /66LPP   {66 LPP} def
  76. /78LPP   {78 LPP} def
  77. /88LPP   {88 LPP} def
  78. /1Font   {1 FSet} def
  79. /2Font   {2 FSet} def
  80. /3Font   {3 FSet} def
  81. % Synonyms
  82. /LETTER  {Letter} def/letter {Letter} def
  83. /LEGAL   {Legal} def /legal {Legal} def
  84. /a4      {A4} def        
  85. /PORT    {Port} def /port {Port} def
  86. /LAND    {Land} def /land {Land} def
  87. /60lpp {60LPP} def
  88. /66lpp {66LPP} def
  89. /78lpp {78LPP} def
  90. /88lpp {88LPP} def
  91. /1FONT {1Font} def /1font {1Font} def
  92. /2FONT {2Font} def /2font {2Font} def
  93. /3FONT {3Font} def /3font {3Font} def
  94. % ------ End
  95. %
  96. % Page Setup
  97. /PSet {
  98.          initmatrix
  99.          CurFSet FSet
  100.          /CPI 10 def
  101.          /LPI 6 def
  102.          /HMI 72 def
  103.          /VMI 72 def
  104.          paper 1 eq
  105.                   {orient 1 eq      % letter
  106.                            {/w 8.5 def /h 10.0 def             % letter port
  107.                            nLPP 60 eq {/h 10.0 def} if
  108.                            nLPP 66 eq {/h 10.1 def /LPI 6.6 def} if
  109.                            nLPP 78 eq {/h 13.0 def} if
  110.                            }
  111.                            {/w 11.0 def /h 7.5 def             % letter land
  112.                            /nLPP 45 def
  113.                            } ifelse
  114.                   } if
  115.          paper 2 eq
  116.                   {orient 1 eq      % legal
  117.                            {/w 8.5 def /h 13.1 def             % legal port
  118.                            /nLPP 78 def
  119.                            }
  120.                            {/w 14.0 def /h 6.5 def             % legal land
  121.                            /nLPP 45 def
  122.                            } ifelse
  123.                   } if
  124.          paper 3 eq
  125.                   {orient 1 eq      % A4
  126.                            {/w 8.5 def /h 11 def               % A4 port
  127.                /LPI 6.05 def               % makes labels work
  128.                            nLPP 88 eq {/LPI 8 def} if
  129.                            }
  130.                            {/w 11 def /h 7.5 def               % A4 land
  131.                            /nLPP 45 def
  132.                            } ifelse
  133.                   } if
  134.          /PageWidth w def
  135.          /PageHeight h def
  136.    } def
  137.  
  138. % initialize variables
  139. /BaseLine 0 def
  140. /Bon 0 def
  141. /Ion 0 def
  142. /LocalBox 0 def
  143. %----
  144. %
  145. % Define new BaseLine value
  146. /DefBase {        % args = (new baseline)
  147.    /BaseLine exch def
  148.    } def
  149. %
  150. % Move to a new line
  151. /GoNewLine {      % args = (x,y)
  152.    dup DefBase moveto
  153.    currentpoint exch pop 0 lt {FF} if
  154.    } def
  155. %
  156. % Rotate and/or Translate (if nec.)
  157. /RoTran {
  158.          orient 1 eq
  159.                   {paper 1 eq                                  % PORTRAIT
  160.                            {tpxoff tpyoff translate}           % Letter
  161.                            {paper 2 eq
  162.                                     {gpxoff gpyoff translate}  % Legal
  163.                                     {apxoff apyoff translate}  % A4
  164.                            ifelse
  165.                            } 
  166.                   ifelse
  167.                   }
  168.                   {-90 rotate                                  % LANDSCAPE
  169.                   paper 1 eq
  170.                            {11.0}                              % Letter
  171.                            {paper 2 eq
  172.                                     {14.0}                     % Legal
  173.                                     {11.5}                     % A4
  174.                            ifelse
  175.                            }
  176.                   ifelse
  177.                   VMI mul neg 0 translate
  178.                   
  179.                   paper 1 eq
  180.                            {tlxoff tlyoff translate}           % Letter
  181.                            {paper 2 eq
  182.                                     {glxoff glyoff translate}  % Legal
  183.                                     {alxoff alyoff translate}  % A4
  184.                                     ifelse
  185.                                     }
  186.                            ifelse
  187.  
  188.                   /LPI 6 def}
  189.                   ifelse
  190.          } def
  191. %
  192. %        Move to top left corner of new page
  193. /Home {
  194.    RoTran
  195.    clear
  196.    0
  197.    PageHeight VMI mul
  198.       GoNewLine CRLF
  199.    } def
  200. %
  201. % Set nLPP
  202. /LPP {   % arg = (#lines per page)
  203.    /nLPP exch def
  204.    PSet
  205.    Home
  206.    } def
  207. % Chg Orientation or Paper
  208. %
  209. /OrientPaper {
  210.          PSet
  211.          Home
  212.          } def
  213. %
  214. %        Initialization
  215. /Init {
  216.    1.415 setmiterlimit
  217.    Home
  218.    Norm
  219.    } def
  220. %
  221. % FormFeed
  222. /FF {
  223.    showpage
  224.    Home
  225.    } def
  226. %
  227. % Carriage Return w/o LF
  228. /CR {
  229.    currentpoint
  230.    exch  pop
  231.    0
  232.    exch moveto
  233.    } def
  234. %
  235. % Carriage Return w/ Line Feed
  236. /CRLF {
  237.    CR currentpoint
  238.    VMI LPI div
  239.    sub
  240.    paper 3 ne { round } if     %% forces a4 7x2's to line up correctly
  241.    GoNewLine
  242.    } def
  243. %
  244. % Backspace
  245. /BS {
  246.    currentpoint
  247.    exch                    % bring x-pos to top
  248.    ( ) stringwidth         % get current font x,y size
  249.    pop                     % get rid of y-size
  250.    sub                     % backup 1 char's worth
  251.    exch moveto
  252.    } def
  253. %
  254. % Establish a different font
  255. /NewFont {
  256.    CurFont findfont
  257.    CurPoint scalefont
  258.    setfont
  259.    } def
  260. %
  261. % Start compressed (15 cpi) print
  262. /Cmp+ {/CurPoint CompressedPoint def NewFont} def
  263. %
  264. % End compressed print
  265. /Cmp- {/CurPoint PicaPoint def NewFont} def
  266. %
  267. % Start Pica pitch
  268. /10Cpi {/CurPoint PicaPoint def NewFont} def
  269. %
  270. % Start Elite pitch
  271. /12Cpi {/CurPoint ElitePoint def NewFont} def
  272. %
  273. % Change to a different font (same size): aFont ChgFont
  274. /ChgFont {
  275.    /CurFont exch def
  276.    CurFont findfont
  277.    CurPoint scalefont
  278.    setfont
  279.    } def
  280. %
  281. % Select un-attributed text
  282. /Norm {
  283.    FontNorm ChgFont
  284.    /Bon 0 def
  285.    /Ion 0 def
  286.    } def
  287. %
  288. % Select bolded text
  289. /Bold {
  290.    Ion 0 eq
  291.       {FontBold ChgFont}
  292.       {FontBoldItal ChgFont}
  293.       ifelse
  294.    /Bon 1 def
  295.    } def
  296. %
  297. % Select un-Bolded text
  298. /BNorm {
  299.    Ion 0 eq
  300.       {FontNorm ChgFont}
  301.       {FontItal ChgFont}
  302.       ifelse
  303.    /Bon 0 def
  304.    } def
  305. %
  306. % Select italicized text
  307. /Ital {
  308.    Bon 0 eq
  309.       {FontItal ChgFont}
  310.       {FontBoldItal ChgFont}
  311.       ifelse
  312.    /Ion 1 def
  313.    } def
  314. %
  315. % Select un-Italicized text
  316. /INorm {
  317.    Bon 0 eq
  318.       {FontNorm ChgFont}
  319.       {FontBold ChgFont}
  320.       ifelse
  321.    /Ion 0 def
  322.    } def
  323. %
  324. % Select bold+italicized text
  325. /BoIt {
  326.    FontBoldItal ChgFont
  327.    /Bon 1 def
  328.    /Ion 1 def
  329.    } def
  330. %
  331. % 1. calc a positive line movement of 1/2 the current point size
  332. % 2. move to the current baseline position
  333. /Script {
  334.    VMI CurPoint idiv 2 idiv
  335.    currentpoint pop BaseLine moveto
  336.    } def
  337. %
  338. % Start superscript
  339. /Sup+ {0 Script rmoveto} def
  340. %
  341. % End superscript
  342. /Sup- {Script pop} def
  343. %
  344. % Start subscript
  345. /Sub+ {0 Script neg rmoveto} def
  346. %
  347. % End subscript
  348. /Sub- {Script pop} def
  349. %
  350. % Start underlined text
  351. /Und+ {
  352.    currentpoint pop BaseLine        % estab start of underline position
  353.    2 sub                   % Y-pos = 2 points down from baseline
  354.    } def
  355. %
  356. % End underlined text
  357. /Und- {
  358.    currentpoint   % save current location
  359.    Und+ moveto    % move to ending underline position
  360.    4 2 roll                % bring starting underline position to top of stack
  361.    lineto                  % draw the line
  362.    stroke
  363.    moveto                  % return to original location
  364.    } def
  365. %
  366. % Overstrike 1st char w/ 2nd char
  367. /OV {             % string OV
  368.    /str 2 1 roll def
  369.    currentpoint
  370.    str 0 1 getinterval show
  371.    moveto
  372.    str 1 1 getinterval show
  373.    } def
  374. %
  375. % we are going to draw characters using current size
  376. % each point in movement is 1/72 of an inch
  377. % curpoint has the current character pitch selected
  378. % we'll use an oversized cell to contain all characters
  379. % to handle porportionally spaced font
  380. % Character height to be calculated from current lpi setting
  381. % character width to be calculated from current pitch setting
  382. %
  383. % Horizontal Line CHR(196) for single, CHR(205) for double
  384. /A {
  385.     /MLineHeight 72 LPI div 2 div def
  386.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  387.     /MLineWidth ( ) stringwidth pop 2 div def
  388.     show
  389.     currentpoint
  390.     0 MLineHeight rmoveto
  391.     MLineWidth 2 mul 0 rlineto
  392.     stroke
  393.     moveto
  394.     MLineWidth 2 mul 0 rmoveto
  395.    } def
  396. %
  397. /B {
  398.     /MLineHeight 72 LPI div 2 div def
  399.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  400.     /MLineWidth ( ) stringwidth pop 2 div def
  401.     show
  402.     currentpoint
  403.     0 MLineHeight 1 sub rmoveto
  404.     MLineWidth 2 mul 0 rlineto
  405.     stroke
  406.     moveto
  407.     currentpoint
  408.     0 MLineHeight 1 add rmoveto
  409.     MLineWidth 2 mul 0 rlineto
  410.     stroke
  411.     moveto
  412.     MLineWidth 2 mul 0 rmoveto
  413.    } def
  414. %
  415. % Vertical Line CHR(179) for single, CHR(186) for double
  416. /C {
  417.     /MLineHeight 72 LPI div 2 div def
  418.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  419.     /MLineWidth ( ) stringwidth pop 2 div def
  420.     show
  421.     currentpoint
  422.     MLineWidth 0 rmoveto
  423.     0 MLineHeight 2 mul rlineto
  424.     stroke
  425.     moveto
  426.     MLineWidth 2 mul 0 rmoveto
  427.    } def
  428. %
  429. /D {
  430.     /MLineHeight 72 LPI div 2 div def
  431.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  432.     /MLineWidth ( ) stringwidth pop 2 div def
  433.     show
  434.     currentpoint
  435.     MLineWidth 1 sub 0 rmoveto
  436.     0 MLineHeight 2 mul rlineto
  437.     stroke
  438.     moveto
  439.     currentpoint
  440.     MLineWidth 1 add 0 rmoveto
  441.     0 MLineHeight 2 mul rlineto
  442.     stroke
  443.     moveto
  444.     MLineWidth 2 mul 0 rmoveto
  445.    } def
  446. %
  447. % Top Left Corner    CHR(218) for single, CHR(201) for double
  448. /E {
  449.     /MLineHeight 72 LPI div 2 div def
  450.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  451.     /MLineWidth ( ) stringwidth pop 2 div def
  452.     show
  453.     currentpoint
  454.     MLineWidth 0 rmoveto
  455.     0 MLineHeight rlineto
  456.     MLineWidth 0 rlineto
  457.     stroke
  458.     moveto
  459.     MLineWidth 2 mul 0 rmoveto
  460.    } def
  461. %
  462. /F {
  463.     /MLineHeight 72 LPI div 2 div def
  464.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  465.     /MLineWidth ( ) stringwidth pop 2 div def
  466.     show
  467.     currentpoint
  468.     MLineWidth 1 sub 0 rmoveto
  469.     0 MLineHeight 1 add rlineto
  470.     MLineWidth 1 add 0 rlineto
  471.     stroke
  472.     moveto
  473.     currentpoint
  474.     MLineWidth 1 add 0 rmoveto
  475.     0 MLineHeight 1 sub  rlineto
  476.     MLineWidth 1 sub 0 rlineto
  477.     stroke
  478.     moveto
  479.     MLineWidth 2 mul 0 rmoveto
  480.    } def
  481. %
  482. % Bottom Left Corner    CHR(192) for single, CHR(200) for double
  483. /G {
  484.     /MLineHeight 72 LPI div 2 div def
  485.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  486.     /MLineWidth ( ) stringwidth pop 2 div def
  487.     show
  488.     currentpoint
  489.     MLineWidth MLineHeight 2 mul rmoveto
  490.     0 0 MLineHeight sub rlineto
  491.     MLineWidth 0 rlineto
  492.     stroke
  493.     moveto
  494.     MLineWidth 2 mul 0 rmoveto
  495.    } def
  496. %
  497. /H {
  498.     /MLineHeight 72 LPI div 2 div def
  499.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  500.     /MLineWidth ( ) stringwidth pop 2 div def
  501.     show
  502.     currentpoint
  503.     MLineWidth 1 sub MLineHeight 2 mul rmoveto
  504.     0 0 MLineHeight 1 add sub rlineto
  505.     MLineWidth 1 add 0 rlineto
  506.     stroke
  507.     moveto
  508.     currentpoint
  509.     MLineWidth 1 add MLineHeight 2 mul rmoveto
  510.     0 0 MLineHeight 1 sub sub  rlineto
  511.     MLineWidth 1 sub 0 rlineto
  512.     stroke
  513.     moveto
  514.     MLineWidth 2 mul 0 rmoveto
  515.    } def
  516. %
  517. % Top Right Corner    CHR(191) for single, CHR(187) for double
  518. /I {
  519.     /MLineHeight 72 LPI div 2 div def
  520.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  521.     /MLineWidth ( ) stringwidth pop 2 div def
  522.     show
  523.     currentpoint
  524.     0 MLineHeight rmoveto
  525.     MLineWidth 0 rlineto
  526.     0 0 MLineHeight sub rlineto
  527.     stroke
  528.     moveto
  529.     MLineWidth 2 mul 0 rmoveto
  530.    } def
  531. %
  532. /J {
  533.     /MLineHeight 72 LPI div 2 div def
  534.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  535.     /MLineWidth ( ) stringwidth pop 2 div def
  536.     show
  537.     currentpoint
  538.     0 MLineHeight 1 add rmoveto
  539.     MLineWidth 1 add 0 rlineto
  540.     0 0 MLineHeight 1 add sub rlineto
  541.     stroke
  542.     moveto
  543.     currentpoint
  544.     0 MLineHeight 1 sub rmoveto
  545.     MLineWidth 1 sub 0 rlineto
  546.     0 0 MLineHeight 1 sub sub rlineto
  547.     stroke
  548.     moveto
  549.     MLineWidth 2 mul 0 rmoveto
  550.    } def
  551. %
  552. % Bottom Right Corner    CHR(217) for single, CHR(188) for double
  553. /K {
  554.     /MLineHeight 72 LPI div 2 div def
  555.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  556.     /MLineWidth ( ) stringwidth pop 2 div def
  557.     show
  558.     currentpoint
  559.     0 MLineHeight rmoveto
  560.     MLineWidth 0 rlineto
  561.     0 MLineHeight rlineto
  562.     stroke
  563.     moveto
  564.     MLineWidth 2 mul 0 rmoveto
  565.    } def
  566. %
  567. /L {
  568.     /MLineHeight 72 LPI div 2 div def
  569.     /MLineWidth 72 CurPoint div 5 mul 8 div def
  570.     /MLineWidth ( ) stringwidth pop 2 div def
  571.     show
  572.     currentpoint
  573.     0 MLineHeight 1 sub rmoveto
  574.     MLineWidth 1 add 0 rlineto
  575.     0 MLineHeight 1 add rlineto
  576.     stroke
  577.     moveto
  578.     currentpoint
  579.     0 MLineHeight 1 add  rmoveto
  580.     MLineWidth 1 sub 0 rlineto
  581.     0 MLineHeight 1 sub rlineto
  582.     stroke
  583.     moveto
  584.     MLineWidth 2 mul 0 rmoveto
  585.    } def
  586. %
  587. /reencodedict 36 dict def
  588. /ReEncode
  589.   {reencodedict begin
  590.    /newfontname exch def
  591.    /basefontname exch def
  592.    /basefontdict basefontname findfont def
  593.    /newfont basefontdict maxlength dict def
  594.    basefontdict
  595.      {exch dup /FID ne
  596.        {dup /Encoding eq
  597.          {exch dup length array copy
  598.             newfont 3 1 roll put}
  599.          {exch newfont 3 1 roll put}
  600.          ifelse}
  601.        {pop pop}
  602.        ifelse
  603.      } forall
  604.    newfont /FontName newfontname put
  605.    foreignvec aload pop
  606.    foreignvec length 2 idiv
  607.    {newfont /Encoding get 3 1 roll put}
  608.    repeat
  609.    newfontname newfont definefont pop
  610.    end 
  611.   } def
  612. /foreignvec [
  613. 128 /Ccedilla
  614. 129 /udieresis
  615. 130 /eacute
  616. 131 /acircumflex
  617. 132 /adieresis
  618. 133 /agrave
  619. 134 /aring
  620. 135 /ccedilla
  621. 136 /ecircumflex
  622. 137 /edieresis
  623. 138 /egrave
  624. 139 /idieresis
  625. 140 /icircumflex
  626. 141 /igrave
  627. 142 /Adieresis
  628. 143 /Aring
  629. 144 /Eacute
  630. 145 /ae
  631. 146 /AE
  632. 147 /ocircumflex
  633. 148 /odieresis
  634. 149 /ograve
  635. 150 /ucircumflex
  636. 151 /ugrave
  637. 152 /ydieresis
  638. 153 /Odieresis
  639. 154 /Udieresis
  640. 155 /cent
  641. 156 /sterling
  642. 157 /yen
  643. 159 /florin
  644. 160 /aacute
  645. 161 /iacute
  646. 162 /oacute
  647. 163 /uacute
  648. 164 /ntilde
  649. 165 /Ntilde
  650. 166 /ordfeminine
  651. 167 /ordmasculine
  652. 168 /questiondown
  653. 173 /exclamdown
  654. 174 /guillemotleft
  655. 175 /guillemotright
  656. 225 /germandbls
  657. 249 /bullet
  658. ] def
  659. /Courier /Courier-Foreign ReEncode
  660. /Courier-Bold /Courier-Bold-Foreign ReEncode
  661. /Courier-Oblique /Courier-Oblique-Foreign ReEncode
  662. /Courier-BoldOblique /Courier-BoldOblique-Foreign ReEncode
  663. /Helvetica /Helvetica-Foreign ReEncode
  664. /Helvetica-Bold /Helvetica-Bold-Foreign ReEncode
  665. /Helvetica-Oblique /Helvetica-Oblique-Foreign ReEncode
  666. /Helvetica-BoldOblique /Helvetica-BoldOblique-Foreign ReEncode
  667. /Times-Roman /Times-Roman-Foreign ReEncode
  668. /Times-Bold /Times-Bold-Foreign ReEncode
  669. /Times-Italic /Times-Italic-Foreign ReEncode
  670. /Times-BoldItalic /Times-BoldItalic-Foreign ReEncode
  671. PSet
  672. %----- end of Postscri.dld ----
  673.