Mercurial > hg > xemacs-beta
comparison lisp/mule/chinese.el @ 4072:aa28d959af41
[xemacs-hg @ 2007-07-22 22:03:29 by aidan]
Add support for non-ISO2022 8 bit fixed-width coding-systems
author | aidan |
---|---|
date | Sun, 22 Jul 2007 22:04:14 +0000 |
parents | 98af8a976fc3 |
children | 476d0799d704 |
comparison
equal
deleted
inserted
replaced
4071:d607d13fca67 | 4072:aa28d959af41 |
---|---|
29 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are | 29 ;; For Chinese, three character sets GB2312, BIG5, and CNS11643 are |
30 ;; supported. | 30 ;; supported. |
31 | 31 |
32 ;;; Code: | 32 ;;; Code: |
33 | 33 |
34 (eval-when-compile | 34 (eval-when-compile (progn (require 'ccl "mule-ccl") (require 'china-util))) |
35 (require 'china-util)) | |
36 | |
37 ; (make-charset 'chinese-gb2312 | |
38 ; "GB2312 Chinese simplified: ISO-IR-58" | |
39 ; '(dimension | |
40 ; 2 | |
41 ; registry "GB2312.1980" | |
42 ; chars 94 | |
43 ; columns 2 | |
44 ; direction l2r | |
45 ; final ?A | |
46 ; graphic 0 | |
47 ; short-name "GB2312" | |
48 ; long-name "GB2312: ISO-IR-58" | |
49 ; )) | |
50 | |
51 ; (make-charset 'chinese-cns11643-1 | |
52 ; "CNS11643 Plane 1 Chinese traditional: ISO-IR-171" | |
53 ; '(dimension | |
54 ; 2 | |
55 ; registry "CNS11643.1992-1" | |
56 ; chars 94 | |
57 ; columns 2 | |
58 ; direction l2r | |
59 ; final ?G | |
60 ; graphic 0 | |
61 ; short-name "CNS11643-1" | |
62 ; long-name "CNS11643-1 (Chinese traditional): ISO-IR-171" | |
63 ; )) | |
64 | |
65 ; (make-charset 'chinese-cns11643-2 | |
66 ; "CNS11643 Plane 2 Chinese traditional: ISO-IR-172" | |
67 ; '(dimension | |
68 ; 2 | |
69 ; registry "CNS11643.1992-2" | |
70 ; chars 94 | |
71 ; columns 2 | |
72 ; direction l2r | |
73 ; final ?H | |
74 ; graphic 0 | |
75 ; short-name "CNS11643-2" | |
76 ; long-name "CNS11643-2 (Chinese traditional): ISO-IR-172" | |
77 ; )) | |
78 | |
79 ; (make-charset 'chinese-big5-1 | |
80 ; "Frequently used part (A141-C67F) of Big5 (Chinese traditional)" | |
81 ; '(dimension | |
82 ; 2 | |
83 ; registry "Big5" | |
84 ; chars 94 | |
85 ; columns 2 | |
86 ; direction l2r | |
87 ; final ?0 | |
88 ; graphic 0 | |
89 ; short-name "Big5 (Level-1)" | |
90 ; long-name "Big5 (Level-1) A141-C67F" | |
91 ; )) | |
92 | |
93 ; (make-charset 'chinese-big5-2 | |
94 ; "Less frequently used part (C940-FEFE) of Big5 (Chinese traditional)" | |
95 ; '(dimension | |
96 ; 2 | |
97 ; registry "Big5" | |
98 ; chars 94 | |
99 ; columns 2 | |
100 ; direction l2r | |
101 ; final ?1 | |
102 ; graphic 0 | |
103 ; short-name "Big5 (Level-2)" | |
104 ; long-name "Big5 (Level-2) C940-FEFE" | |
105 ; )) | |
106 | 35 |
107 ;; Syntax of Chinese characters. | 36 ;; Syntax of Chinese characters. |
108 (modify-syntax-entry 'chinese-gb2312 "w") | |
109 (loop for row in '(33 34 41) | 37 (loop for row in '(33 34 41) |
110 do (modify-syntax-entry `[chinese-gb2312 ,row] ".")) | 38 do (modify-syntax-entry `[chinese-gb2312 ,row] ".")) |
111 ;;(loop for row from 35 to 40 | |
112 ;; do (modify-syntax-entry `[chinese-gb2312 ,row] "w")) | |
113 ;;(loop for row from 42 to 126 | |
114 ;; do (modify-syntax-entry `[chinese-gb2312 ,row] "w")) | |
115 | |
116 (modify-syntax-entry 'chinese-cns11643-1 "w") | |
117 (modify-syntax-entry 'chinese-cns11643-2 "w") | |
118 (modify-syntax-entry 'chinese-big5-1 "w") | |
119 (modify-syntax-entry 'chinese-big5-2 "w") | |
120 | |
121 ; ;; Chinese CNS11643 Plane3 thru Plane7. Although these are official | |
122 ; ;; character sets, the use is rare and don't have to be treated | |
123 ; ;; space-efficiently in the buffer. | |
124 ; (make-charset 'chinese-cns11643-3 | |
125 ; "CNS11643 Plane 3 Chinese Traditional: ISO-IR-183" | |
126 ; '(dimension | |
127 ; 2 | |
128 ; registry "CNS11643.1992-3" | |
129 ; chars 94 | |
130 ; columns 2 | |
131 ; direction l2r | |
132 ; final ?I | |
133 ; graphic 0 | |
134 ; short-name "CNS11643-3" | |
135 ; long-name "CNS11643-3 (Chinese traditional): ISO-IR-183" | |
136 ; )) | |
137 | 39 |
138 ;; CNS11643 Plane3 thru Plane7 | 40 ;; CNS11643 Plane3 thru Plane7 |
139 ;; These represent more and more obscure Chinese characters. | 41 ;; These represent more and more obscure Chinese characters. |
140 ;; By the time you get to Plane 7, we're talking about characters | 42 ;; By the time you get to Plane 7, we're talking about characters |
141 ;; that appear once in some ancient manuscript and whose meaning | 43 ;; that appear once in some ancient manuscript and whose meaning |
376 ;; In: R0:chinese-big5-1 or chinese-big5-2 | 278 ;; In: R0:chinese-big5-1 or chinese-big5-2 |
377 ;; R1:position code 1 | 279 ;; R1:position code 1 |
378 ;; R2:position code 2 | 280 ;; R2:position code 2 |
379 ;; Out: R1:font code point 1 | 281 ;; Out: R1:font code point 1 |
380 ;; R2:font code point 2 | 282 ;; R2:font code point 2 |
381 ((r2 = ((((r1 - ?\x21) * 94) + r2) - ?\x21)) | 283 ((r2 = ((((r1 - #x21) * 94) + r2) - #x21)) |
382 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280)) | 284 (if (r0 == ,(charset-id 'chinese-big5-2)) (r2 += 6280)) |
383 (r1 = ((r2 / 157) + ?\xA1)) | 285 (r1 = ((r2 / 157) + #xA1)) |
384 (r2 %= 157) | 286 (r2 %= 157) |
385 (if (r2 < ?\x3F) (r2 += ?\x40) (r2 += ?\x62)))) | 287 (if (r2 < #x3F) (r2 += #x40) (r2 += #x62)))) |
386 "CCL program to encode a Big5 code to code point of Big5 font.") | 288 "CCL program to encode a Big5 code to code point of Big5 font.") |
387 | |
388 ;; (setq font-ccl-encoder-alist | |
389 ;; (cons (cons "big5" ccl-encode-big5-font) font-ccl-encoder-alist)) | |
390 | 289 |
391 (set-charset-ccl-program 'chinese-big5-1 'ccl-encode-big5-font) | 290 (set-charset-ccl-program 'chinese-big5-1 'ccl-encode-big5-font) |
392 (set-charset-ccl-program 'chinese-big5-2 'ccl-encode-big5-font) | 291 (set-charset-ccl-program 'chinese-big5-2 'ccl-encode-big5-font) |
393 | 292 |
394 (set-language-info-alist | 293 (set-language-info-alist |