File: elvis.ps

package info (click to toggle)
elvis 2.1i-3
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 4,120 kB
  • ctags: 5,838
  • sloc: ansic: 53,854; sh: 811; makefile: 263
file content (189 lines) | stat: -rw-r--r-- 7,276 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
% 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
%
% In addition, the implementations of the Elvis*Page procedures given here
% depend on the following measurements, expressed in Points:
%     ElvisLeftEdge  offset to left edge of printable area
%     ElvisTopEdge   offset to right edge of printable area
%     ElvisWidth     width of printable area
%     ElvisHeight    height of printable area

% 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

% The following should be true to enable the feature, or false to disable it
/ElvisBar false def	% bar separating pages in two-up format
/ElvisFrame true def	% frame around each page in two-up format
/ElvisPunch false def	% increase left margin to leave room for a 3-hole punch
/ElvisClip false def	% increase top margin for use with a clipboard

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%                                                         %%%%%%%%%%%%
%%%%%%%%%%  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 {
	/ElvisWidth 576 def
	/ElvisHeight 720 def } 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

% 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 courier fonts
/Elvis-Normal /Courier DoTheLatinShuffle
/Elvis-Bold /Courier-Bold DoTheLatinShuffle
/Elvis-Italic /Courier-Oblique 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

% 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