home *** CD-ROM | disk | FTP | other *** search
- % lib/elvis.ps
- %
- % This file is inserted into any PostScript generated by elvis. It defines
- % the following symbols:
- % ElvisN push a 12-point normal font
- % ElvisB push a 12-point bold font
- % ElvisI push a 12-point italic font
- % ElvisPage translate & scale a page to fit the paper
- % ElvisLeftPage translate, rotate & scale to fit left half of paper
- % ElvisRightPage translate, rotate & scale to fit right half of paper
- % ElvisLeftEdge CONSTANT offset to left edge of printable area
- % ElvisTopEdge CONSTANT offset to right edge of printable area
- % ElvisWidth CONSTANT width of printable area
- % ElvisHeight CONSTANT height of printable area
- %
- % In addition, elvis itself inserts some header information before this file,
- % in each PostScript output. This includes the standard comments at the top
- % of the job, and also defines the following from elvis' options...
- % ElvisPaper CONSTANT name of the page size, such as (letter) or (a4)
- % ElvisLines CONSTANT lines per logical page
- % ElvisColumns CONSTANT columns per logical line
- % ElvisBar CONSTANT BOOL bar separating pages in two-up format
- % ElvisFrame CONSTANT BOOL frame around each page in two-up format
- % ElvisPunch CONSTANT BOOL increase left margin to leave room for a 3-hole punch
- % ElvisClip CONSTANT BOOL increase top margin for use with a clipboard
-
- % Define the printing offsets. These indicate where the *PRINTABLE* portion
- % of each page starts. This is likely to vary from one printer to another.
- % The unit of measurement is a Point, approximately 1/72 of an inch.
- /ElvisLeftEdge 12 def
- /ElvisTopEdge 36 def
-
- % Define the width and height of the printable area. This will vary with
- % the type of paper. The unit of measurement is a Point, ~ 1/72 of an inch.
- (letter) ElvisPaper eq {
- /ElvisWidth 576 def
- /ElvisHeight 720 def } if
- (legal) ElvisPaper eq {
- /ElvisWidth 576 def
- /ElvisHeight 936 def } if
- (executive) ElvisPaper eq {
- /ElvisWidth 486 def
- /ElvisHeight 634 def } if
- (a4) ElvisPaper eq {
- /ElvisWidth 558 def
- /ElvisHeight 770 def } if
- (a3) ElvisPaper eq {
- /ElvisWidth 770 def
- /ElvisHeight 1116 def } if
-
- % Get the size of the print area, and its edge offsets
-
-
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%% %%%%%%%%%%%%
- %%%%%%%%%% You probably won't need to modify anything after this %%%%%%%%%%%%
- %%%%%%%%%% %%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- % If ElvisWidth/ElvisHeight undefined, use default values
- true userdict { pop /ElvisWidth eq { pop false } if } forall {
- /ElvisHSlop 24 def
- /ElvisWSlop 9 def
- clippath pathbbox 4 2 roll
- /ElvisTopEdge exch ElvisHSlop add def
- /ElvisLeftEdge exch ElvisWSlop add def
- /ElvisHeight exch ElvisTopEdge sub ElvisHSlop 2 mul sub def
- /ElvisWidth exch ElvisLeftEdge sub ElvisWSlop 2 mul sub def
- newpath
- } if
-
- % Adjust for punch
- ElvisPunch ElvisLeftEdge 60 le and {
- userdict /ElvisWidth ElvisWidth ElvisLeftEdge add 60 sub put
- userdict /ElvisLeftEdge 60 put
- } if
-
- %Adjust for clipboard
- ElvisClip ElvisTopEdge 72 le and {
- userdict /ElvisHeight ElvisHeight ElvisTopEdge add 72 sub put
- userdict /ElvisTopEdge 72 put
- } if
-
- % The virtual width/height varies with the number of rows/columns. For
- % 80 columns by 60 rows, it is always 576 by 720 regardless of the paper size.
- /ElvisVWidth ElvisColumns 80 div 576 mul def
- /ElvisVHeight ElvisLines 60 div 720 mul def
-
- % Compute the desired width of a string, instead of its actual width
- /ElvisStringWidth
- {
- length ElvisColumns div ElvisVWidth mul
- } def
-
- % Draw a string with the width that it would have if it was fixed-pitch.
- /ElvisShow
- {
- % {string}
-
- % Push two copies of the string.
- dup dup
-
- % {string string string}
-
- % Compute the scaling factors -- x=desired/normal, y=1.
- ElvisStringWidth exch stringwidth pop div 1
-
- % {string xscale yscale}
-
- % Change scaling factor, but only temporarily. {string}
- gsave scale
-
- % {string}
-
- % Draw the text {}
- show
-
- % Restore the scaling factor, leaving the currentpoint after text. {}
- currentpoint grestore moveto
- } def
-
- % This array lists the shapes of every Latin-1 character.
- /Latin1
- [/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
- /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
- /parenleft /parenright /asterisk /plus /comma /minus /period /slash
- /zero /one /two /three /four /five /six /seven
- /eight /nine /colon /semicolon /less /equal /greater /question
- /at /A /B /C /D /E /F /G
- /H /I /J /K /L /M /N /O
- /P /Q /R /S /T /U /V /W
- /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
- /quoteleft /a /b /c /d /e /f /g
- /h /i /j /k /l /m /n /o
- /p /q /r /s /t /u /v /w
- /x /y /z /braceleft /bar /braceright /asciitilde /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /space /space /space /space /space /space /space
- /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
- /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
- /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
- /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
- /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
- /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
- /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
- /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
- /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
- /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icurcumflex /idieresis
- /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
- /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] def
-
- % This procedure is passed two names - The name of a new font to create, and
- % the name of an existing font to create it from. Upon completion, the
- % args have been removed from the stack and the new font is defined. The
- % only difference between the two is that the new font uses the Latin-1
- % encoding.
- /DoTheLatinShuffle
- {
- findfont
- dup maxlength dict /Temp exch def
- { exch dup dup /FID ne exch /UniqueID ne and
- { exch Temp 3 1 roll put }
- { pop pop }
- ifelse
- } forall
- Temp dup /Encoding Latin1 put
- definefont pop
- } def
-
- % Derive 3 Latin-1 fonts from the existing fonts
- /Elvis-Normal /Courier DoTheLatinShuffle
- /Elvis-Bold /Courier-Bold DoTheLatinShuffle
- /Elvis-Italic /Courier-Oblique DoTheLatinShuffle
- /Elvis-Proportional-Normal /Times-Roman DoTheLatinShuffle
- /Elvis-Proportional-Bold /Times-Bold DoTheLatinShuffle
- /Elvis-Proportional-Italic /Times-Italic DoTheLatinShuffle
-
- % Define symbolic names for the 12-point versions of those fonts
- /ElvisN /Elvis-Normal findfont 12 scalefont def
- /ElvisB /Elvis-Bold findfont 12 scalefont def
- /ElvisI /Elvis-Italic findfont 12 scalefont def
- /ElvisPN /Elvis-Proportional-Normal findfont 12 scalefont def
- /ElvisPB /Elvis-Proportional-Bold findfont 12 scalefont def
- /ElvisPI /Elvis-Proportional-Italic findfont 12 scalefont def
-
- % Define the page-scaling functions
- /ElvisPage
- {
- ElvisLeftEdge ElvisTopEdge translate
- ElvisWidth ElvisVWidth div ElvisHeight ElvisVHeight div scale
- } def
- /ElvisLeftPage
- {
- ElvisLeftEdge ElvisWidth add ElvisTopEdge translate
- 90 rotate
- ElvisHeight ElvisVWidth 2 mul div ElvisWidth ElvisVHeight div scale
- ElvisWidth 0.02 mul ElvisHeight 0.02 mul translate 0.94 0.96 scale
-
- 0 setlinewidth
-
- % Draw a frame around page
- ElvisFrame {
- -5 -5 moveto
- ElvisVWidth 10 add 0 rlineto
- 0 ElvisVHeight 10 add rlineto
- ElvisVWidth 10 add neg 0 rlineto
- closepath stroke
- } if
- } def
- /ElvisRightPage
- {
- % Draw a line between left & right pages
- ElvisBar {
- newpath
- ElvisLeftEdge ElvisTopEdge ElvisHeight 2 div add moveto
- ElvisWidth 0 rlineto
- stroke
- } if
-
- ElvisLeftEdge ElvisWidth add ElvisTopEdge ElvisHeight 2 div add translate
- 90 rotate
- ElvisHeight ElvisVWidth 2 mul div ElvisWidth ElvisVHeight div scale
- ElvisWidth 0.04 mul ElvisHeight 0.02 mul translate 0.94 0.96 scale
-
- 0 setlinewidth
-
- % Draw a frame around page
- ElvisFrame {
- -5 -5 moveto
- ElvisVWidth 10 add 0 rlineto
- 0 ElvisVHeight 10 add rlineto
- ElvisVWidth 10 add neg 0 rlineto
- closepath stroke
- } if
- } def
-