Blob


1 %
2 % Encoding vector, operator and procedure redefinitions for Plan 9 UTF
3 % encoding. Prologues are expected to take steps to ensure operator
4 % redefinitions given here are actually used. Current implementation
5 % assumes UTF byte streams that represent ASCII or Latin1 text.
6 %
8 /UTFLatin1Encoding [
9 /.notdef
10 /.notdef
11 /.notdef
12 /.notdef
13 /.notdef
14 /.notdef
15 /.notdef
16 /.notdef
17 /.notdef
18 /.notdef
19 /.notdef
20 /.notdef
21 /.notdef
22 /.notdef
23 /.notdef
24 /.notdef
25 /.notdef
26 /.notdef
27 /.notdef
28 /.notdef
29 /.notdef
30 /.notdef
31 /.notdef
32 /.notdef
33 /.notdef
34 /.notdef
35 /.notdef
36 /.notdef
37 /.notdef
38 /.notdef
39 /.notdef
40 /.notdef
41 /space
42 /exclam
43 /quotedbl
44 /numbersign
45 /dollar
46 /percent
47 /ampersand
48 /quoteright
49 /parenleft
50 /parenright
51 /asterisk
52 /plus
53 /comma
54 /minus
55 /period
56 /slash
57 /zero
58 /one
59 /two
60 /three
61 /four
62 /five
63 /six
64 /seven
65 /eight
66 /nine
67 /colon
68 /semicolon
69 /less
70 /equal
71 /greater
72 /question
73 /at
74 /A
75 /B
76 /C
77 /D
78 /E
79 /F
80 /G
81 /H
82 /I
83 /J
84 /K
85 /L
86 /M
87 /N
88 /O
89 /P
90 /Q
91 /R
92 /S
93 /T
94 /U
95 /V
96 /W
97 /X
98 /Y
99 /Z
100 /bracketleft
101 /backslash
102 /bracketright
103 /asciicircum
104 /underscore
105 /quoteleft
106 /a
107 /b
108 /c
109 /d
110 /e
111 /f
112 /g
113 /h
114 /i
115 /j
116 /k
117 /l
118 /m
119 /n
120 /o
121 /p
122 /q
123 /r
124 /s
125 /t
126 /u
127 /v
128 /w
129 /x
130 /y
131 /z
132 /braceleft
133 /bar
134 /braceright
135 /asciitilde
136 /.notdef
137 /.notdef
138 /.notdef
139 /.notdef
140 /.notdef
141 /.notdef
142 /.notdef
143 /.notdef
144 /.notdef
145 /.notdef
146 /.notdef
147 /.notdef
148 /.notdef
149 /.notdef
150 /.notdef
151 /.notdef
152 /.notdef
153 /dotlessi
154 /grave
155 /acute
156 /circumflex
157 /tilde
158 /macron
159 /breve
160 /dotaccent
161 /dieresis
162 /.notdef
163 /ring
164 /cedilla
165 /.notdef
166 /hungarumlaut
167 /ogonek
168 /caron
169 /space
170 /exclamdown
171 /cent
172 /sterling
173 /currency
174 /yen
175 /brokenbar
176 /section
177 /dieresis
178 /copyright
179 /ordfeminine
180 /guillemotleft
181 /logicalnot
182 /hyphen
183 /registered
184 /macron
185 /degree
186 /plusminus
187 /twosuperior
188 /threesuperior
189 /acute
190 /mu
191 /paragraph
192 /periodcentered
193 /cedilla
194 /onesuperior
195 /ordmasculine
196 /guillemotright
197 /onequarter
198 /onehalf
199 /threequarters
200 /questiondown
201 /Agrave
202 /Aacute
203 /Acircumflex
204 /Atilde
205 /Adieresis
206 /Aring
207 /AE
208 /Ccedilla
209 /Egrave
210 /Eacute
211 /Ecircumflex
212 /Edieresis
213 /Igrave
214 /Iacute
215 /Icircumflex
216 /Idieresis
217 /Eth
218 /Ntilde
219 /Ograve
220 /Oacute
221 /Ocircumflex
222 /Otilde
223 /Odieresis
224 /multiply
225 /Oslash
226 /Ugrave
227 /Uacute
228 /Ucircumflex
229 /Udieresis
230 /Yacute
231 /Thorn
232 /germandbls
233 /agrave
234 /aacute
235 /acircumflex
236 /atilde
237 /adieresis
238 /aring
239 /ae
240 /ccedilla
241 /egrave
242 /eacute
243 /ecircumflex
244 /edieresis
245 /igrave
246 /iacute
247 /icircumflex
248 /idieresis
249 /eth
250 /ntilde
251 /ograve
252 /oacute
253 /ocircumflex
254 /otilde
255 /odieresis
256 /divide
257 /oslash
258 /ugrave
259 /uacute
260 /ucircumflex
261 /udieresis
262 /yacute
263 /thorn
264 /ydieresis
265 ] def
267 /NewFontDirectory FontDirectory maxlength dict def
270 % Apparently no guarantee findfont is defined in systemdict so the obvious
272 % systemdict /findfont get exec
274 % can generate an error. So far the only exception is a VT600 (version 48.0).
277 userdict /@RealFindfont known not {
278 userdict begin
279 /@RealFindfont systemdict begin /findfont load end def
280 end
281 } if
283 /findfont {
284 dup NewFontDirectory exch known not {
285 dup
286 %dup systemdict /findfont get exec % not always in systemdict
287 dup userdict /@RealFindfont get exec
288 dup /Encoding get StandardEncoding eq {
289 dup length 1 add dict begin
290 {1 index /FID ne {def}{pop pop} ifelse} forall
291 /Encoding UTFLatin1Encoding def
292 /Metrics 1 dict def
293 Metrics /.notdef 0 put
294 currentdict
295 end
296 /DummyFontName exch definefont
297 } if
298 NewFontDirectory 3 1 roll put
299 } if
300 NewFontDirectory exch get
301 } bind def
304 % UTF string decoding for ASCII and Latin1 only:
306 % C2 XX => 00 XX
307 % C3 XX => XX+40 00
309 % Two passes through each string with search is undoubtedly faster than
310 % PostScript that examines each byte.
313 /UTFstring {
314 dup {
315 (\302) search {
316 pop
317 0 0 put
318 }{pop exit} ifelse
319 } loop
320 dup {
321 (\303) search {
322 pop
323 1 index 0 get 16#40 add 0 exch put
324 dup length 0 gt {dup 0 0 put} if
325 }{pop exit} ifelse
326 } loop
327 } bind def
329 /ashow {mark 4 1 roll UTFstring //ashow cvx exec cleartomark} bind def
330 /awidthshow {mark 7 1 roll UTFstring //awidthshow cvx exec cleartomark} bind def
331 /show {mark exch UTFstring //show cvx exec cleartomark} bind def
332 /stringwidth {UTFstring //stringwidth cvx exec} bind def
333 /widthshow {mark 5 1 roll UTFstring //widthshow cvx exec cleartomark} bind def
336 % kshow is harder - stack can't change because of the procedure.
339 /kshow dup load type /operatortype eq
340 {{UTFstring kshow} bind}
341 {{UTFstring //kshow cvx exec} bind}
342 ifelse def