aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/postscript/psencoding/UTF.enc
blob: 234764e3439166a3a68062ef6c9224361b84ea92 (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
331
332
%
% Encoding vector, operator and procedure redefinitions for Plan 9 UTF
% encoding. Prologues are expected to take steps to ensure operator
% redefinitions given here are actually used. Current implementation
% assumes UTF byte streams that represent ASCII or Latin1 text.
%

/UTFLatin1Encoding [
	/.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
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/.notdef
	/dotlessi
	/grave
	/acute
	/circumflex
	/tilde
	/macron
	/breve
	/dotaccent
	/dieresis
	/.notdef
	/ring
	/cedilla
	/.notdef
	/hungarumlaut
	/ogonek
	/caron
	/.notdef		% was 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
	/icircumflex
	/idieresis
	/eth
	/ntilde
	/ograve
	/oacute
	/ocircumflex
	/otilde
	/odieresis
	/divide
	/oslash
	/ugrave
	/uacute
	/ucircumflex
	/udieresis
	/yacute
	/thorn
	/ydieresis
] def

/NewFontDirectory FontDirectory maxlength dict def

%
% Apparently no guarantee findfont is defined in systemdict so the obvious
%
%	systemdict /findfont get exec
%
% can generate an error. So far the only exception is a VT600 (version 48.0).
%

userdict /@RealFindfont known not {
	userdict begin
		/@RealFindfont systemdict begin /findfont load end def
	end
} if

/findfont {
	dup NewFontDirectory exch known not {
		dup
		%dup systemdict /findfont get exec	% not always in systemdict
		dup userdict /@RealFindfont get exec
		dup /Encoding get StandardEncoding eq {
			dup length 1 add dict begin
				{1 index /FID ne {def}{pop pop} ifelse} forall
				/Encoding UTFLatin1Encoding def
				/Metrics 1 dict def
				Metrics /.notdef 0 put
				currentdict
			end
			/DummyFontName exch definefont
		} if
		NewFontDirectory 3 1 roll put
	} if
	NewFontDirectory exch get
} bind def

%
% Assume A0, except for A0A0 which is replaced by 20A0, can be ignored.
% Works with ASCII or Latin1 because A0 has been re-encoded as a zero
% width non-printing character. 
%

/UTFstring {
	dup {
		(\240\240) search {
			pop
			0 16#20 put
		}{pop exit} ifelse
	} loop
} bind def

/ashow {mark 4 1 roll UTFstring //ashow cvx exec cleartomark} bind def
/awidthshow {mark 7 1 roll UTFstring //awidthshow cvx exec cleartomark} bind def
/show {mark exch UTFstring //show cvx exec cleartomark} bind def
/stringwidth {UTFstring //stringwidth cvx exec} bind def
/widthshow {mark 5 1 roll UTFstring //widthshow cvx exec cleartomark} bind def

%
% kshow is harder - stack can't change because of the procedure.
%

/kshow dup load type /operatortype eq
	{{UTFstring kshow} bind}
	{{UTFstring //kshow cvx exec} bind}
ifelse def