summaryrefslogtreecommitdiff
path: root/fonts/utilities/t1tools/pcs.ps
blob: 004f42982264e178fc154fccdb4dcf4b26ee1941 (plain)
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
%! print and compare font character sets
/home {leftmargin top moveto} def
/rightmargin {leftmargin} def
/sethome {/top exch def /leftmargin exch def} def
/setfontsize {/fontsize exch def} def
/setrightborder {/rightborder exch def} def
70 740 sethome
20 setfontsize
550 setrightborder
/leading 4 def
/nl {currentpoint exch pop leftmargin exch
	fontsize sub leading sub moveto} def
/hl {currentpoint exch pop leftmargin exch
	fontsize 2 div sub leading sub moveto} def

/comparecs {
	fontlist dup 0 get fontsize ffont /reffont exch def
	1 get fontsize ffont /chkfont exch def

	chkfont /FontInfo get /ItalicAngle get abs
	dup [ 1 0 4 -1 roll sin 1 0 0 ] /slantmatrix exch def
	home
	[cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7]
	{   {
		currentpoint ( ) dup 0 6 -1 roll put dup /ch exch def
		reffont setfont show
		currentpoint	% stack: x0 y0 x y
		4 2 roll pop	% stack: x y x0
		3 copy pop pop sub	% stack: x y x0-x
		chkfont setfont ch stringwidth pop dup /width exch def
		sub 2 div 0 rmoveto
		 0 fontsize neg rmoveto currentpoint
		% here we are at base point of character to be shown
		% draw width and height reference box:
		 0 fontsize slantmatrix transform
		 2 copy 2 copy rmoveto neg exch neg exch rlineto
		 width 0 rlineto rlineto
		 0 setlinewidth
	%	 currentrgbcolor .5 .0 .0 setrgbcolor stroke setrgbcolor
	%	 2 copy moveto
	%	 0 fontsize
	%	 2 copy 2 copy rmoveto neg exch neg exch rlineto
	%	 width 0 rlineto rlineto
		 currentrgbcolor .0 .5 .0 setrgbcolor stroke setrgbcolor
		% back to base point:
		 moveto
		 ch show
		moveto
		fontsize 5 div 0 rmoveto
	    } forall
	    nl nl
	} forall
	} def

/findfont+ {dup findfont
	dup maxlength dict begin
	{1 index dup /FID ne exch /UniqueID ne and
		{def} {pop pop} ifelse} forall
	Encoding StandardEncoding eq
	% pop true	% for unconditional re-encoding
	  {/Encoding Win31+
	   % pop CP437 % CP437 / CP850 / PrestigeElite-additionals / ...
	   def} if
	currentdict end
	definefont
	} def
/ffont {exch findfont+ exch dup /fontsize exch def scalefont
	} def
/ff {exch findfont+ exch dup /fontsize exch def scalefont
	setfont} def

/fontlist [] def
%/newfontnames [/font2 /font1] def
/FontDirectoryKnown FontDirectory dup length 20 add dict copy def
/appendnewfont {
	/fontlist [ fontlist aload pop
	FontDirectoryKnown begin
	FontDirectory
	{FontDirectoryKnown 2 index known {pop pop} {2 copy def pop} ifelse
	} forall
	end
	% font renaming to allow comparison of two fonts with equal name:
	% third attempt, useless
	%	findfont
	%	/newfontnames
	%	 [ newfontnames aload pop /newfontname exch def ] def
	%	newfontname exch definefont pop
	%	newfontname
	] def
	} def
/setreffont {
	[ exch ] /fontlist exch def
	} def
/registerfont {run appendnewfont} def

/=dict { % for debugging
	{2 array astore ==} forall
	} def

{
% the following module should allow multiple samples with the same font name
% but it does not work
/appendnewfont {} def
%/*definefont /definefont load def
/*definefont {definefont} bind def
/fontnamelist [] def
/fontnewnames [/f1 /f2] def
/fontnewnamei 0 def
/definefont {
	% (definefont) =
	2 copy *definefont /FontName get /fontname exch def
					% this yields "invalidaccess" !???
	/fontnamelist [ fontnamelist aload pop fontname ] def
	/fontnewname fontnewnames fontnewnamei get def
	/fontnewnamei dup load 1 add def
	/fontlist [ fontlist aload pop fontnewname ] def
	exch pop fontnewname exch
	*definefont
	%/*definefont load exec
	} store
} pop

{
% the following module should allow multiple samples with the same font name
% second attempt, doesn't work either
/fontnamelist [] def
/fontnewnames [/f1 /f2] def
/fontnewnamei 0 def
/appendnewfont {
	FontDirectory
	dup length dict /FontNewDirectory exch def
	dup length dict /FontDirectoryKnown exch def
	{FontDirectoryKnown 2 index known
	 {FontNewDirectory 3 copy pop put
	  FontDirectoryKnown 3 copy pop put
	 }
	 {
		/fontnewname fontnewnames fontnewnamei get def
		/fontnewnamei dup load 1 add def
		FontNewDirectory fontnewname 2 index put
		FontDirectoryKnown fontnewname 2 index put
		/fontlist [ fontlist aload pop fontnewname ] def
fontnewname ==
	 }
	 ifelse
	 pop pop
	} forall
	/FontDirectory FontNewDirectory def
	} def
} pop

/fillsample {	% param: name from-code
	32 string dup
	3 -1 roll dup 1 exch 31 add
		{dup 32 mod exch put dup}
		for pop def
	} def
/cs0	0 fillsample
/cs1	32 fillsample
/cs2	64 fillsample
/cs3	96 fillsample
/cs4	128 fillsample
/cs5	160 fillsample
/cs6	192 fillsample
/cs7	224 fillsample

/Win31+ [
% Windows 3.1 character set extended with other common characters,
% nbspace instead of second space, minus instead of second hyphen;
% first 32 positions filled up with additional characters from MacIntosh.
% Windows 3.1 character set is basically an extension of ISO Latin-1 
% with a few deviations.
/NUL /HT /LF /CR /DLE /DC1 /DC2 /DC3 /DC4 /US /RS /DEL
/lessequal /greaterequal /notequal /approxequal /lozenge /apple
/infinity /partialdiff /summation /product /integral /radical
/Delta /Omega /pi 
/breve /dotaccent /hungarumlaut /ogonek /ring 
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle
/parenleft /parenright /asterisk /plus /comma /hyphen /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
/grave /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 /fraction

/fi /fl /quotesinglbase /florin 
	/quotedblbase /ellipsis /dagger /daggerdbl 
/circumflex /perthousand /Scaron /guilsinglleft /OE /Lslash /Zcaron /caron 
/dotlessi /quoteleft /quoteright /quotedblleft 
	/quotedblright /bullet /endash /emdash 
/tilde /trademark /scaron /guilsinglright /oe /lslash /zcaron /Ydieresis 

/nbspace /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /minus /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 /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def

/PrestigeElite-additionals [
/.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
/Hbar /IJ /Ldot /Tbar /dbar /hbar /ij /kgreenlandic 
/ldot /napostrophe /tbar 
/Gamma /Omega /Phi /Sigma /Theta 
/alpha /delta /epsilon 
/phi /pi /sigma /tau 
/Pts /deutschmark /franc 
/oneeighth 
/threeeighths /fiveeighths /seveneighths 
/Eng /apostrophereverse 
/approxequal /arrowboth /arrowdown 
/arrowleft /arrowright /arrowup /caretinverted 
/club /diamond /diamondopen /eng 
/equivalence /exclamdbl /female /filledbox /greaterequal 
/heart /infinity /intersection /lessequal 
/male /minus /monospacedash /musicalnote 
/musicalnotedbl /nsuperior /overscore /radical 
/spade /underscoredbl /zeroslash /SA420000 
/SD630000 /SF010000 /SF020000 /SF030000 /SF040000 /SF050000 /SF060000 /SF070000 
/SF080000 /SF090000 /SF100000 /SF110000 /SF140000 /SF150000 /SF160000 /SF190000 
/SF200000 /SF210000 /SF220000 /SF230000 /SF240000 /SF250000 /SF260000 /SF270000 
/SF280000 /SF360000 /SF370000 /SF380000 /SF390000 /SF400000 /SF410000 /SF420000 
/SF430000 /SF440000 /SF450000 /SF460000 /SF470000 /SF480000 /SF490000 /SF500000 
/SF510000 /SF520000 /SF530000 /SF540000 /SF570000 /SF580000 /SF590000 /SF600000 
/SF610000 /SM570001 /SM590000 /SM600000 /SM630000 /SM680000 /SM690000 /SM700000 
/SM750000 /SM750002 /SM760000 /SM770000 /SM790000 /SP320000 /SS000000 /SS010000 
/SS260000 /SS270000 /SV040000 /.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 /.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 /.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
] def

/CP437 [
/space/SS000000/SS010000/heart/diamond/club/spade/bullet 
/SM570001/HT/SM750002/male/female/musicalnote/musicalnotedbl/SM690000 
/SM590000/SM630000/SM760000/exclamdbl/paragraph/section/SM700000/SM770000 
/arrowup/arrowdown/arrowright/arrowleft/SA420000/arrowboth/SM600000/SV040000 
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle
/parenleft /parenright /asterisk /plus /comma /hyphen /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
/grave /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 
/SM790000 
% 
/Ccedilla/udieresis/eacute/acircumflex/adieresis/agrave/aring/ccedilla
/ecircumflex/edieresis/egrave/idieresis/icircumflex/igrave/Adieresis/Aring
/Eacute/ae/AE/ocircumflex/odieresis/ograve/ucircumflex/ugrave
/ydieresis/Odieresis/Udieresis/cent/sterling/yen/Pts/florin
% 
/aacute/iacute/oacute/uacute/ntilde/Ntilde/ordfeminine/ordmasculine
/questiondown /SM680000 /logicalnot/onehalf/onequarter/exclamdown
/guillemotleft /guillemotright 
/SF140000/SF150000/SF160000/SF110000/SF090000/SF190000/SF200000/SF210000 
/SF220000/SF230000/SF240000/SF250000/SF260000/SF270000/SF280000/SF030000 
% 
/SF020000/SF070000/SF060000/SF080000/SF100000/SF050000/SF360000/SF370000 
/SF380000/SF390000/SF400000/SF410000/SF420000/SF430000/SF440000/SF450000 
/SF460000/SF470000/SF480000/SF490000/SF500000/SF510000/SF520000/SF530000 
/SF540000/SF040000/SF010000/SF610000/SF570000/SF580000/SF590000/SF600000 
% 
/alpha /germandbls /Gamma /pi /Sigma /sigma /mu /gamma 
/Phi /Theta /Omega /delta /infinity /infinity /epsilon /intersection 
/equivalence /plusminus /greaterequal /lessequal
/SS260000/SS270000 /divide /approxequal 
/degree /SD630000 /SP320000 /radical /nsuperior /twosuperior /filledbox /space
] def

/CP850 [
/space/SS000000/SS010000/heart/diamond/club/spade/bullet 
/SM570001/HT/SM750002/male/female/musicalnote/musicalnotedbl/SM690000 
/SM590000/SM630000/SM760000/exclamdbl/paragraph/section/SM700000/SM770000 
/arrowup/arrowdown/arrowright/arrowleft/SA420000/arrowboth/SM600000/SV040000 
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle
/parenleft /parenright /asterisk /plus /comma /hyphen /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
/grave /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 
/SM790000 
% 
/Ccedilla/udieresis/eacute/acircumflex/adieresis/agrave/aring/ccedilla
/ecircumflex/edieresis/egrave/idieresis/icircumflex/igrave/Adieresis/Aring
/Eacute/ae/AE/ocircumflex/odieresis/ograve/ucircumflex/ugrave
/ydieresis/Odieresis/Udieresis/oslash/sterling/Oslash/multiply/florin
% 
/aacute/iacute/oacute/uacute/ntilde/Ntilde/ordfeminine/ordmasculine
/questiondown/registered/logicalnot/onehalf/onequarter/exclamdown
/guillemotleft /guillemotright 
/SF140000/SF150000/SF160000/SF110000/SF090000 /Aacute /Acircumflex /Agrave 
/copyright /SF230000/SF240000/SF250000/SF260000 /cent /yen /SF030000 
% 
/SF020000/SF070000/SF060000/SF080000/SF100000/SF050000 /atilde /Atilde 
/SF380000/SF390000/SF400000/SF410000/SF420000/SF430000/SF440000 /currency 
/delta /Eth /Ecircumflex /Edieresis /Egrave /quotesingle /Iacute /Icircumflex 
/Idieresis /SF040000/SF010000/SF610000/SF570000 /brokenbar /Igrave /SF600000 
% 
/Oacute /germandbls /Ocircumflex /Ograve /otilde /Otilde /mu /thorn
/Thorn /Uacute /Ucircumflex /Ugrave /yacute /Yacute /macron /acute 
/minus /plusminus /underscoredbl /threequarters
/paragraph /section /divide /cedilla
/degree /dieresis /periodcentered /onesuperior
/threesuperior /twosuperior /filledbox /space
] def