diff options
| author | Kenichi Handa | 2002-09-30 06:41:01 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-09-30 06:41:01 +0000 |
| commit | 84fa2951d989afa98a4d770807deca14adb22550 (patch) | |
| tree | c9e4224cb0d4c077186a48b62d118a1a1e4ae11c | |
| parent | 06859d9e51377e71943da476a80c7b3da03a18fe (diff) | |
| download | emacs-84fa2951d989afa98a4d770807deca14adb22550.tar.gz emacs-84fa2951d989afa98a4d770807deca14adb22550.zip | |
(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.*-*".
| -rw-r--r-- | lisp/international/fontset.el | 87 |
1 files changed, 61 insertions, 26 deletions
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 9ea6e8d3f8e..2c73d46b532 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el | |||
| @@ -142,35 +142,70 @@ | |||
| 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. |