comparison lisp/international/fontset.el @ 47711:d99378556333

(ucs-mule-to-mule-unicode): Define this translation table name here. (ucs-mule-cjk-to-unicode): New translation table name. (ccl-encode-unicode-font): Merge the code in ucs-tables.el. (font-ccl-encoder-alist): Change the font registry pattern to "ISO10646.*-*".
author Kenichi Handa <handa@m17n.org>
date Mon, 30 Sep 2002 06:41:01 +0000
parents 9638b242156c
children 5cb7e7103296
comparison
equal deleted inserted replaced
47710:6025c7c2fa78 47711:d99378556333
140 )) 140 ))
141 141
142 (set-font-encoding "ISO8859-1" 'ascii 0) 142 (set-font-encoding "ISO8859-1" 'ascii 0)
143 (set-font-encoding "JISX0201" 'latin-jisx0201 0) 143 (set-font-encoding "JISX0201" 'latin-jisx0201 0)
144 144
145 ;; Allow display of arbitrary characters with an iso-10646-encoded
146 ;; (`Unicode') font.
147 (define-translation-table 'ucs-mule-to-mule-unicode
148 ucs-mule-to-mule-unicode)
149 (define-translation-hash-table 'ucs-mule-cjk-to-unicode
150 ucs-mule-cjk-to-unicode)
151
145 (define-ccl-program ccl-encode-unicode-font 152 (define-ccl-program ccl-encode-unicode-font
146 `(0 153 `(0
147 (if (r0 == ,(charset-id 'ascii)) 154 ;; r0: charset-id
148 ((r2 = r1) 155 ;; r1: 1st position code
149 (r1 = 0)) 156 ;; r2: 2nd position code (if r0 is 2D charset)
150 (if (r0 == ,(charset-id 'latin-iso8859-1)) 157 ((if (r0 == ,(charset-id 'ascii))
151 ((r2 = (r1 + 128)) 158 ((r2 = r1)
152 (r1 = 0)) 159 (r1 = 0))
153 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff)) 160 ;; At first, try to get a Unicode code point directly.
154 ((r1 *= 96) 161 ((if (r2 >= 0)
155 (r1 += r2) 162 ;; This is a 2D charset.
156 (r1 += ,(- #x100 (* 32 96) 32)) 163 (r1 = ((r1 << 7) | r2)))
157 (r1 >8= 0) 164 (lookup-character ucs-mule-cjk-to-unicode r0 r1)
158 (r2 = r7)) 165 (if r7
159 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff)) 166 ;; We got it!
160 ((r1 *= 96) 167 ((r1 = (r0 >> 8))
161 (r1 += r2) 168 (r2 = (r0 & #xFF)))
162 (r1 += ,(- #x2500 (* 32 96) 32)) 169 ;; Look for a translation for non-ASCII chars.
163 (r1 >8= 0) 170 ((translate-character ucs-mule-to-mule-unicode r0 r1)
164 (r2 = r7)) 171 (if (r0 == ,(charset-id 'latin-iso8859-1))
165 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff)) 172 ((r2 = (r1 + 128))
166 ((r1 *= 96) 173 (r1 = 0))
167 (r1 += r2) 174 ((r2 = (r1 & #x7F))
168 (r1 += ,(- #xe000 (* 32 96) 32)) 175 (r1 >>= 7)
169 (r1 >8= 0) 176 (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
170 (r2 = r7))))))))) 177 ((r1 *= 96)
171 178 (r1 += r2)
179 (r1 += ,(- #x100 (* 32 96) 32))
180 (r1 >8= 0)
181 (r2 = r7))
182 (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
183 ((r1 *= 96)
184 (r1 += r2)
185 (r1 += ,(- #x2500 (* 32 96) 32))
186 (r1 >8= 0)
187 (r2 = r7))
188 (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
189 ((r1 *= 96)
190 (r1 += r2)
191 (r1 += ,(- #xe000 (* 32 96) 32))
192 (r1 >8= 0)
193 (r2 = r7))
194 ;; No way, use the glyph for U+FFFD.
195 ((r1 = #xFF)
196 (r2 = #xFD)))))))))))))
197 "Encode characters for display with iso10646 font.
198 Translate through the translation-hash-table named
199 `ucs-mule-cjk-to-unicode' and the translation-table named
200 `ucs-mule-to-mule-unicode' initially.")
201
202 ;; Use the above CCL encoder for Unicode fonts. Please note that the
203 ;; regexp is not simply "ISO10646-1" because there exists, for
204 ;; instance, the following Devanagari Unicode fonts:
205 ;; -misc-fixed-medium-r-normal--24-240-72-72-c-120-iso10646.indian-1
206 ;; -sibal-devanagari-medium-r-normal--24-240-75-75-P--iso10646-dev
172 (setq font-ccl-encoder-alist 207 (setq font-ccl-encoder-alist
173 (cons '("ISO10646-1" . ccl-encode-unicode-font) 208 (cons '("ISO10646.*-*" . ccl-encode-unicode-font)
174 font-ccl-encoder-alist)) 209 font-ccl-encoder-alist))
175 210
176 ;; Setting for suppressing XLoadQueryFont on big fonts. 211 ;; Setting for suppressing XLoadQueryFont on big fonts.
177 (setq x-pixel-size-width-font-regexp 212 (setq x-pixel-size-width-font-regexp
178 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5") 213 "gb2312\\|jisx0208\\|ksc5601\\|cns11643\\|big5")