UTF.enc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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. %
  7. /UTFLatin1Encoding [
  8. /.notdef
  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. /space
  41. /exclam
  42. /quotedbl
  43. /numbersign
  44. /dollar
  45. /percent
  46. /ampersand
  47. /quoteright
  48. /parenleft
  49. /parenright
  50. /asterisk
  51. /plus
  52. /comma
  53. /minus
  54. /period
  55. /slash
  56. /zero
  57. /one
  58. /two
  59. /three
  60. /four
  61. /five
  62. /six
  63. /seven
  64. /eight
  65. /nine
  66. /colon
  67. /semicolon
  68. /less
  69. /equal
  70. /greater
  71. /question
  72. /at
  73. /A
  74. /B
  75. /C
  76. /D
  77. /E
  78. /F
  79. /G
  80. /H
  81. /I
  82. /J
  83. /K
  84. /L
  85. /M
  86. /N
  87. /O
  88. /P
  89. /Q
  90. /R
  91. /S
  92. /T
  93. /U
  94. /V
  95. /W
  96. /X
  97. /Y
  98. /Z
  99. /bracketleft
  100. /backslash
  101. /bracketright
  102. /asciicircum
  103. /underscore
  104. /quoteleft
  105. /a
  106. /b
  107. /c
  108. /d
  109. /e
  110. /f
  111. /g
  112. /h
  113. /i
  114. /j
  115. /k
  116. /l
  117. /m
  118. /n
  119. /o
  120. /p
  121. /q
  122. /r
  123. /s
  124. /t
  125. /u
  126. /v
  127. /w
  128. /x
  129. /y
  130. /z
  131. /braceleft
  132. /bar
  133. /braceright
  134. /asciitilde
  135. /.notdef
  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. /dotlessi
  153. /grave
  154. /acute
  155. /circumflex
  156. /tilde
  157. /macron
  158. /breve
  159. /dotaccent
  160. /dieresis
  161. /.notdef
  162. /ring
  163. /cedilla
  164. /.notdef
  165. /hungarumlaut
  166. /ogonek
  167. /caron
  168. /.notdef % was space
  169. /exclamdown
  170. /cent
  171. /sterling
  172. /currency
  173. /yen
  174. /brokenbar
  175. /section
  176. /dieresis
  177. /copyright
  178. /ordfeminine
  179. /guillemotleft
  180. /logicalnot
  181. /hyphen
  182. /registered
  183. /macron
  184. /degree
  185. /plusminus
  186. /twosuperior
  187. /threesuperior
  188. /acute
  189. /mu
  190. /paragraph
  191. /periodcentered
  192. /cedilla
  193. /onesuperior
  194. /ordmasculine
  195. /guillemotright
  196. /onequarter
  197. /onehalf
  198. /threequarters
  199. /questiondown
  200. /Agrave
  201. /Aacute
  202. /Acircumflex
  203. /Atilde
  204. /Adieresis
  205. /Aring
  206. /AE
  207. /Ccedilla
  208. /Egrave
  209. /Eacute
  210. /Ecircumflex
  211. /Edieresis
  212. /Igrave
  213. /Iacute
  214. /Icircumflex
  215. /Idieresis
  216. /Eth
  217. /Ntilde
  218. /Ograve
  219. /Oacute
  220. /Ocircumflex
  221. /Otilde
  222. /Odieresis
  223. /multiply
  224. /Oslash
  225. /Ugrave
  226. /Uacute
  227. /Ucircumflex
  228. /Udieresis
  229. /Yacute
  230. /Thorn
  231. /germandbls
  232. /agrave
  233. /aacute
  234. /acircumflex
  235. /atilde
  236. /adieresis
  237. /aring
  238. /ae
  239. /ccedilla
  240. /egrave
  241. /eacute
  242. /ecircumflex
  243. /edieresis
  244. /igrave
  245. /iacute
  246. /icircumflex
  247. /idieresis
  248. /eth
  249. /ntilde
  250. /ograve
  251. /oacute
  252. /ocircumflex
  253. /otilde
  254. /odieresis
  255. /divide
  256. /oslash
  257. /ugrave
  258. /uacute
  259. /ucircumflex
  260. /udieresis
  261. /yacute
  262. /thorn
  263. /ydieresis
  264. ] def
  265. /NewFontDirectory FontDirectory maxlength dict def
  266. %
  267. % Apparently no guarantee findfont is defined in systemdict so the obvious
  268. %
  269. % systemdict /findfont get exec
  270. %
  271. % can generate an error. So far the only exception is a VT600 (version 48.0).
  272. %
  273. userdict /@RealFindfont known not {
  274. userdict begin
  275. /@RealFindfont systemdict begin /findfont load end def
  276. end
  277. } if
  278. /findfont {
  279. dup NewFontDirectory exch known not {
  280. dup
  281. %dup systemdict /findfont get exec % not always in systemdict
  282. dup userdict /@RealFindfont get exec
  283. dup /Encoding get StandardEncoding eq {
  284. dup length 1 add dict begin
  285. {1 index /FID ne {def}{pop pop} ifelse} forall
  286. /Encoding UTFLatin1Encoding def
  287. /Metrics 1 dict def
  288. Metrics /.notdef 0 put
  289. currentdict
  290. end
  291. /DummyFontName exch definefont
  292. } if
  293. NewFontDirectory 3 1 roll put
  294. } if
  295. NewFontDirectory exch get
  296. } bind def
  297. %
  298. % Assume A0, except for A0A0 which is replaced by 20A0, can be ignored.
  299. % Works with ASCII or Latin1 because A0 has been re-encoded as a zero
  300. % width non-printing character.
  301. %
  302. /UTFstring {
  303. dup {
  304. (\240\240) search {
  305. pop
  306. 0 16#20 put
  307. }{pop exit} ifelse
  308. } loop
  309. } bind def
  310. /ashow {mark 4 1 roll UTFstring //ashow cvx exec cleartomark} bind def
  311. /awidthshow {mark 7 1 roll UTFstring //awidthshow cvx exec cleartomark} bind def
  312. /show {mark exch UTFstring //show cvx exec cleartomark} bind def
  313. /stringwidth {UTFstring //stringwidth cvx exec} bind def
  314. /widthshow {mark 5 1 roll UTFstring //widthshow cvx exec cleartomark} bind def
  315. %
  316. % kshow is harder - stack can't change because of the procedure.
  317. %
  318. /kshow dup load type /operatortype eq
  319. {{UTFstring kshow} bind}
  320. {{UTFstring //kshow cvx exec} bind}
  321. ifelse def