home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / elvis22g.zip / ELVIS_PS.zip / elvis.ps < prev    next >
Text File  |  1999-10-21  |  7KB  |  190 lines

  1. % lib/elvis.ps
  2. %
  3. % This file is inserted into any PostScript generated by elvis.  It defines
  4. % the following symbols:
  5. %     ElvisN         push a 12-point normal font
  6. %     ElvisB         push a 12-point bold font
  7. %     ElvisI         push a 12-point italic font
  8. %     ElvisPage      translate & scale a page to fit the paper
  9. %     ElvisLeftPage  translate, rotate & scale to fit left half of paper
  10. %     ElvisRightPage translate, rotate & scale to fit right half of paper
  11. %
  12. % In addition, the implementations of the Elvis*Page procedures given here
  13. % depend on the following measurements, expressed in Points:
  14. %     ElvisLeftEdge  offset to left edge of printable area
  15. %     ElvisTopEdge   offset to right edge of printable area
  16. %     ElvisWidth     width of printable area
  17. %     ElvisHeight    height of printable area
  18.  
  19. % Define the printing offsets.  These indicate where the *PRINTABLE* portion
  20. % of each page starts.  This is likely to vary from one printer to another.
  21. % The unit of measurement is a Point, approximately 1/72 of an inch.
  22. /ElvisLeftEdge 12 def
  23. /ElvisTopEdge 36 def
  24.  
  25. % Define the width and height of the printable area.  This will vary with
  26. % the type of paper.  The unit of measurement is a Point, ~ 1/72 of an inch.
  27. (letter) ElvisPaper eq {
  28.     /ElvisWidth 576 def
  29.     /ElvisHeight 720 def } if
  30. (legal) ElvisPaper eq {
  31.     /ElvisWidth 576 def
  32.     /ElvisHeight 936 def } if
  33. (executive) ElvisPaper eq {
  34.     /ElvisWidth 486 def
  35.     /ElvisHeight 634 def } if
  36. (a4) ElvisPaper eq {
  37.     /ElvisWidth 558 def
  38.     /ElvisHeight 770 def } if
  39. (a3) ElvisPaper eq {
  40.     /ElvisWidth 770 def
  41.     /ElvisHeight 1116 def } if
  42.  
  43. % The following should be true to enable the feature, or false to disable it
  44. /ElvisBar false def    % bar separating pages in two-up format
  45. /ElvisFrame true def    % frame around each page in two-up format
  46. /ElvisPunch false def    % increase left margin to leave room for a 3-hole punch
  47. /ElvisClip false def    % increase top margin for use with a clipboard
  48.  
  49. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  50. %%%%%%%%%%                                                         %%%%%%%%%%%%
  51. %%%%%%%%%%  You probably won't need to modify anything after this  %%%%%%%%%%%%
  52. %%%%%%%%%%                                                         %%%%%%%%%%%%
  53. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  54.  
  55. % If ElvisWidth/ElvisHeight undefined, use default values
  56. true userdict { pop /ElvisWidth eq { pop false } if } forall {
  57.     /ElvisWidth 576 def
  58.     /ElvisHeight 720 def } if
  59.  
  60. % Adjust for punch
  61. ElvisPunch ElvisLeftEdge 60 le and {
  62.     userdict /ElvisWidth ElvisWidth ElvisLeftEdge add 60 sub put
  63.     userdict /ElvisLeftEdge 60 put
  64. } if
  65.  
  66. %Adjust for clipboard
  67. ElvisClip ElvisTopEdge 72 le and {
  68.     userdict /ElvisHeight ElvisHeight ElvisTopEdge add 72 sub put
  69.     userdict /ElvisTopEdge 72 put
  70. } if
  71.  
  72. % The virtual width/height varies with the number of rows/columns.  For
  73. % 80 columns by 60 rows, it is always 576 by 720 regardless of the paper size.
  74. /ElvisVWidth ElvisColumns 80 div 576 mul def
  75. /ElvisVHeight ElvisLines 60 div 720 mul def
  76.  
  77. % This array lists the shapes of every Latin-1 character.
  78. /Latin1
  79. [/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  80.  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  81.  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  82.  /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  83.  /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
  84.  /parenleft /parenright /asterisk /plus /comma /minus /period /slash
  85.  /zero /one /two /three /four /five /six /seven
  86.  /eight /nine /colon /semicolon /less /equal /greater /question
  87.  /at /A /B /C /D /E /F /G
  88.  /H /I /J /K /L /M /N /O
  89.  /P /Q /R /S /T /U /V /W
  90.  /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
  91.  /quoteleft /a /b /c /d /e /f /g
  92.  /h /i /j /k /l /m /n /o
  93.  /p /q /r /s /t /u /v /w
  94.  /x /y /z /braceleft /bar /braceright /asciitilde /space
  95.  /space /space /space /space /space /space /space /space
  96.  /space /space /space /space /space /space /space /space
  97.  /space /space /space /space /space /space /space /space
  98.  /space /space /space /space /space /space /space /space
  99.  /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
  100.  /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
  101.  /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
  102.  /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
  103.  /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
  104.  /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
  105.  /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
  106.  /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
  107.  /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
  108.  /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icurcumflex /idieresis
  109.  /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
  110.  /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] def
  111.  
  112. % This procedure is passed two names - The name of a new font to create, and
  113. % the name of an existing font to create it from.  Upon completion, the
  114. % args have been removed from the stack and the new font is defined.  The
  115. % only difference between the two is that the new font uses the Latin-1
  116. % encoding.
  117. /DoTheLatinShuffle
  118. {
  119.     findfont
  120.     dup maxlength dict /Temp exch def
  121.     { exch dup dup /FID ne exch /UniqueID ne and
  122.         { exch Temp 3 1 roll put }
  123.         { pop pop }
  124.         ifelse
  125.     } forall
  126.     Temp dup /Encoding Latin1 put
  127.     definefont pop
  128. } def
  129.  
  130. % Derive 3 Latin-1 fonts from the existing courier fonts
  131. /Elvis-Normal /Courier DoTheLatinShuffle
  132. /Elvis-Bold /Courier-Bold DoTheLatinShuffle
  133. /Elvis-Italic /Courier-Oblique DoTheLatinShuffle
  134.  
  135. % Define symbolic names for the 12-point versions of those fonts
  136. /ElvisN /Elvis-Normal findfont 12 scalefont def
  137. /ElvisB /Elvis-Bold findfont 12 scalefont def
  138. /ElvisI /Elvis-Italic findfont 12 scalefont def
  139.  
  140. % Define the page-scaling functions
  141. /ElvisPage
  142. {
  143.     ElvisLeftEdge ElvisTopEdge translate
  144.     ElvisWidth ElvisVWidth div ElvisHeight ElvisVHeight div scale
  145. } def
  146. /ElvisLeftPage
  147. {
  148.     ElvisLeftEdge ElvisWidth add ElvisTopEdge translate
  149.     90 rotate
  150.     ElvisHeight ElvisVWidth 2 mul div ElvisWidth ElvisVHeight div scale
  151.     ElvisWidth 0.02 mul ElvisHeight 0.02 mul translate 0.94 0.96 scale
  152.  
  153.     0 setlinewidth
  154.  
  155.     % Draw a frame around page
  156.     ElvisFrame {
  157.         -5 -5 moveto
  158.         ElvisVWidth 10 add 0 rlineto
  159.         0 ElvisVHeight 10 add rlineto
  160.         ElvisVWidth 10 add neg 0 rlineto
  161.         closepath stroke
  162.     } if
  163. } def
  164. /ElvisRightPage
  165. {
  166.     % Draw a line between left & right pages
  167.     ElvisBar {
  168.         newpath
  169.         ElvisLeftEdge ElvisTopEdge ElvisHeight 2 div add moveto
  170.         ElvisWidth 0 rlineto
  171.         stroke
  172.     } if
  173.  
  174.     ElvisLeftEdge ElvisWidth add ElvisTopEdge ElvisHeight 2 div add translate
  175.     90 rotate
  176.     ElvisHeight ElvisVWidth 2 mul div ElvisWidth ElvisVHeight div scale
  177.     ElvisWidth 0.04 mul ElvisHeight 0.02 mul translate 0.94 0.96 scale
  178.  
  179.     0 setlinewidth
  180.  
  181.     % Draw a frame around page
  182.     ElvisFrame {
  183.         -5 -5 moveto
  184.         ElvisVWidth 10 add 0 rlineto
  185.         0 ElvisVHeight 10 add rlineto
  186.         ElvisVWidth 10 add neg 0 rlineto
  187.         closepath stroke
  188.     } if
  189. } def
  190.