home *** CD-ROM | disk | FTP | other *** search
/ DOS Wares / doswares.zip / doswares / DATABASE / DBASE4NL / DRIVERS.EXE / POSTSCRI.DLD < prev    next >
Encoding:
Text File  |  1993-05-18  |  6.7 KB  |  340 lines

  1. 
  2. %
  3. %
  4. %
  5. % ctrl-D to clear any hanging input
  6. %
  7. % dBASE IV Postscript Download File (Postscri.dld)
  8. % Copyright 1989 Ashton-Tate
  9. % version 1.12
  10. % --------- User-adjustable parameters -------
  11. % default page size & orientation
  12. /paper 1 def    % (1=letter, 2=legal)
  13. /orient 1 def    % (1=portrait, 2=landscape)
  14. /nLPP 66 def    % lines per page (60, 66, or 78 for portrait; 45 for landscape)
  15. % printer-dependent portrait offsets
  16. /tpxoff 18 def    % x (letter)
  17. /tpyoff 28 def    % y (letter)
  18. /gpxoff 22 def    % x (legal)
  19. /gpyoff 26 def    % y (legal)
  20. % printer-dependent landscape offsets
  21. /tlxoff 10 def    % x (letter)
  22. /tlyoff 44 def    % y (letter)
  23. /glxoff 14 def    % x (legal)
  24. /glyoff 80 def    % y (legal)
  25. % point sizes to use
  26. /PicaPoint 12 def                % Pica
  27. /ElitePoint 10 def                % Elite
  28. /CompressedPoint 8 def            % compressed
  29. /CurPoint        PicaPoint def    % initial pointsize
  30. % fonts to use
  31. /CurFSet 1 def    % default font set
  32. /FSet {
  33.     /CurFSet exch def
  34.     % Font Set 1 (default)
  35.     /n    /Courier def                % normal
  36.     /b    /Courier-Bold def            % bold
  37.     /i    /Courier-Oblique def        % italic
  38.     /bi    /Courier-BoldOblique def    % bold+italic
  39.     CurFSet 2 eq
  40.         {
  41.         /n    /Helvetica def
  42.         /b    /Helvetica-Bold def
  43.         /i    /Helvetica-Oblique def
  44.         /bi    /Helvetica-BoldOblique def
  45.         } if
  46.     CurFSet 3 eq
  47.         {
  48.         /n    /Times-Roman def
  49.         /b    /Times-Bold def
  50.         /i    /Times-Italic def
  51.         /bi    /Times-BoldItalic def
  52.         } if
  53.     /FontNorm n def
  54.     /FontBold b def
  55.     /FontItal i def
  56.     /FontBoldItal bi def
  57.     Norm
  58.    } def
  59. % --------- End User-adjustable parameters -------
  60. % ------ User-callable macros
  61. /Letter {/paper 1 def OrientPaper} def    % Set Letter
  62. /Legal    {/paper 2 def OrientPaper} def    % Set Legal
  63. /Port    {/orient 1 def OrientPaper} def    % Set Portrait
  64. /Land    {/orient 2 def OrientPaper} def    % Set Landscape
  65. /60LPP    {60 LPP} def
  66. /66LPP    {66 LPP} def
  67. /78LPP    {78 LPP} def
  68. /1Font    {1 FSet} def
  69. /2Font    {2 FSet} def
  70. /3Font    {3 FSet} def
  71. % Synonyms
  72. /LETTER {Letter} def /letter {Letter} def
  73. /LEGAL {Legal} def /legal {Legal} def
  74. /PORT {Port} def /port {Port} def
  75. /LAND {Land} def /land {Land} def
  76. /60lpp {60LPP} def
  77. /66lpp {66LPP} def
  78. /78lpp {78LPP} def
  79. /1FONT {1Font} def /1font {1Font} def
  80. /2FONT {2Font} def /2font {2Font} def
  81. /3FONT {3Font} def /3font {3Font} def
  82. % ------ End
  83. %
  84. % Page Setup
  85. /PSet {
  86.     initmatrix
  87.     CurFSet FSet
  88.     /CPI 10 def
  89.     /LPI 6 def
  90.     /HMI 72 def
  91.     /VMI 72 def
  92.     paper 1 eq
  93.         {orient 1 eq    % letter
  94.             {/w 8.5 def /h 10.0 def        % letter port
  95.             nLPP 60 eq {/h 10.0 def} if
  96.             nLPP 66 eq {/h 10.1 def /LPI 6.6 def} if
  97.             nLPP 78 eq {/h 13.0 def} if
  98.             }
  99.             {/w 11.0 def /h 7.5 def        % letter land
  100.             /nLPP 45 def
  101.             } ifelse
  102.         }
  103.         {orient 1 eq     % legal
  104.             {/w 8.5 def /h 13.1 def        % legal port
  105.             /nLPP 78 def
  106.             }
  107.             {/w 14.0 def /h 6.5 def        % legal land
  108.             /nLPP 45 def
  109.             } ifelse
  110.         }
  111.         ifelse
  112.     /PageWidth w def
  113.     /PageHeight h def
  114.    } def
  115.  
  116. % initialize variables
  117. /BaseLine 0 def
  118. /Bon 0 def
  119. /Ion 0 def
  120. %----
  121. %
  122. % Define new BaseLine value
  123. /DefBase {    % args = (new baseline)
  124.    /BaseLine exch def
  125.    } def
  126. %
  127. % Move to a new line
  128. /GoNewLine {    % args = (x,y)
  129.    dup DefBase moveto
  130.    currentpoint exch pop 0 lt {FF} if
  131.    } def
  132. %
  133. % Rotate and/or Translate (if nec.)
  134. /RoTran {
  135.     orient 1 eq
  136.         {paper 1 eq
  137.         {tpxoff tpyoff translate}
  138.         {gpxoff gpyoff translate}
  139.          ifelse
  140.         }
  141.         {-90 rotate
  142.         paper 1 eq
  143.             {11.0}
  144.             {14.0}
  145.             ifelse
  146.         VMI mul neg 0 translate
  147.         
  148.         paper 1 eq    % Translation for LaserWriter Legal-size limits
  149.             {tlxoff tlyoff translate}
  150.             {glxoff glyoff translate}
  151.             ifelse
  152.         /LPI 6 def}
  153.         ifelse
  154.     } def
  155. %
  156. %    Move to top left corner of new page
  157. /Home {
  158.    RoTran
  159.    clear
  160.    0
  161.    PageHeight VMI mul
  162.       GoNewLine CRLF
  163.    } def
  164. %
  165. % Set nLPP
  166. /LPP {    % arg = (#lines per page)
  167.    /nLPP exch def
  168.    PSet
  169.    Home
  170.    } def
  171. % Chg Orientation or Paper
  172. %
  173. /OrientPaper {
  174.     PSet
  175.     Home
  176.     } def
  177. %
  178. %    Initialization
  179. /Init {
  180.    1.415 setmiterlimit
  181.    Home
  182.    Norm
  183.    } def
  184. %
  185. % FormFeed
  186. /FF {
  187.    showpage
  188.    Home
  189.    } def
  190. %
  191. % Carriage Return w/o LF
  192. /CR {
  193.    currentpoint
  194.    exch    pop
  195.    0
  196.    exch moveto
  197.    } def
  198. %
  199. % Carriage Return w/ Line Feed
  200. /CRLF {
  201.    CR currentpoint
  202.    VMI LPI div
  203.    sub round
  204.    GoNewLine
  205.    } def
  206. %
  207. % Backspace
  208. /BS {
  209.    currentpoint
  210.    exch            % bring x-pos to top
  211.    ( ) stringwidth    % get current font x,y size
  212.    pop            % get rid of y-size
  213.    sub            % backup 1 char's worth
  214.    exch moveto
  215.    } def
  216. %
  217. % Establish a different font
  218. /NewFont {
  219.    CurFont findfont
  220.    CurPoint scalefont
  221.    setfont
  222.    } def
  223. %
  224. % Start compressed (15 cpi) print
  225. /Cmp+ {/CurPoint CompressedPoint def NewFont} def
  226. %
  227. % End compressed print
  228. /Cmp- {/CurPoint PicaPoint def NewFont} def
  229. %
  230. % Start Pica pitch
  231. /10Cpi {/CurPoint PicaPoint def NewFont} def
  232. %
  233. % Start Elite pitch
  234. /12Cpi {/CurPoint ElitePoint def NewFont} def
  235. %
  236. % Change to a different font (same size): aFont ChgFont
  237. /ChgFont {
  238.    /CurFont exch def
  239.    CurFont findfont
  240.    CurPoint scalefont
  241.    setfont
  242.    } def
  243. %
  244. % Select un-attributed text
  245. /Norm {
  246.    FontNorm ChgFont
  247.    /Bon 0 def
  248.    /Ion 0 def
  249.    } def
  250. %
  251. % Select bolded text
  252. /Bold {
  253.    Ion 0 eq
  254.       {FontBold ChgFont}
  255.       {FontBoldItal ChgFont}
  256.       ifelse
  257.    /Bon 1 def
  258.    } def
  259. %
  260. % Select un-Bolded text
  261. /BNorm {
  262.    Ion 0 eq
  263.       {FontNorm ChgFont}
  264.       {FontItal ChgFont}
  265.       ifelse
  266.    /Bon 0 def
  267.    } def
  268. %
  269. % Select italicized text
  270. /Ital {
  271.    Bon 0 eq
  272.       {FontItal ChgFont}
  273.       {FontBoldItal ChgFont}
  274.       ifelse
  275.    /Ion 1 def
  276.    } def
  277. %
  278. % Select un-Italicized text
  279. /INorm {
  280.    Bon 0 eq
  281.       {FontNorm ChgFont}
  282.       {FontBold ChgFont}
  283.       ifelse
  284.    /Ion 0 def
  285.    } def
  286. %
  287. % Select bold+italicized text
  288. /BoIt {
  289.    FontBoldItal ChgFont
  290.    /Bon 1 def
  291.    /Ion 1 def
  292.    } def
  293. %
  294. % 1. calc a positive line movement of 1/2 the current point size
  295. % 2. move to the current baseline position
  296. /Script {
  297.    VMI CurPoint idiv 2 idiv
  298.    currentpoint pop BaseLine moveto
  299.    } def
  300. %
  301. % Start superscript
  302. /Sup+ {0 Script rmoveto} def
  303. %
  304. % End superscript
  305. /Sup- {Script pop} def
  306. %
  307. % Start subscript
  308. /Sub+ {0 Script neg rmoveto} def
  309. %
  310. % End subscript
  311. /Sub- {Script pop} def
  312. %
  313. % Start underlined text
  314. /Und+ {
  315.    currentpoint pop BaseLine    % estab start of underline position
  316.    2 sub            % Y-pos = 2 points down from baseline
  317.    } def
  318. %
  319. % End underlined text
  320. /Und- {
  321.    currentpoint    % save current location
  322.    Und+ moveto    % move to ending underline position
  323.    4 2 roll        % bring starting underline position to top of stack
  324.    lineto        % draw the line
  325.    stroke
  326.    moveto        % return to original location
  327.    } def
  328. %
  329. % Overstrike 1st char w/ 2nd char
  330. /OV {        % string OV
  331.    /str 2 1 roll def
  332.    currentpoint
  333.    str 0 1 getinterval show
  334.    moveto
  335.    str 1 1 getinterval show
  336.    } def
  337. %
  338. PSet
  339. %----- end of Postscri.dld ----
  340.