/[emacs]/emacs/lisp/international/fontset.el
ViewVC logotype

Diff of /emacs/lisp/international/fontset.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by eliz, Tue Dec 25 16:29:20 2001 UTC revision 1.54 by handa, Mon Sep 30 06:41:01 2002 UTC
# Line 142  Line 142 
142  (set-font-encoding "ISO8859-1" 'ascii 0)  (set-font-encoding "ISO8859-1" 'ascii 0)
143  (set-font-encoding "JISX0201" 'latin-jisx0201 0)  (set-font-encoding "JISX0201" 'latin-jisx0201 0)
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    
152  (define-ccl-program ccl-encode-unicode-font  (define-ccl-program ccl-encode-unicode-font
153    `(0    `(0
154      (if (r0 == ,(charset-id 'ascii))      ;; r0: charset-id
155          ((r2 = r1)      ;; r1: 1st position code
156           (r1 = 0))      ;; r2: 2nd position code (if r0 is 2D charset)
157        (if (r0 == ,(charset-id 'latin-iso8859-1))      ((if (r0 == ,(charset-id 'ascii))
158            ((r2 = (r1 + 128))           ((r2 = r1)
159             (r1 = 0))            (r1 = 0))
160          (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))         ;; At first, try to get a Unicode code point directly.
161              ((r1 *= 96)         ((if (r2 >= 0)
162               (r1 += r2)              ;; This is a 2D charset.
163               (r1 += ,(- #x100 (* 32 96) 32))              (r1 = ((r1 << 7) | r2)))
164               (r1 >8= 0)          (lookup-character ucs-mule-cjk-to-unicode r0 r1)
165               (r2 = r7))          (if r7
166            (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))              ;; We got it!
167                ((r1 *= 96)              ((r1 = (r0 >> 8))
168                 (r1 += r2)               (r2 = (r0 & #xFF)))
169                 (r1 += ,(- #x2500 (* 32 96) 32))            ;; Look for a translation for non-ASCII chars.
170                 (r1 >8= 0)            ((translate-character ucs-mule-to-mule-unicode r0 r1)
171                 (r2 = r7))             (if (r0 == ,(charset-id 'latin-iso8859-1))
172              (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))                 ((r2 = (r1 + 128))
173                  ((r1 *= 96)                  (r1 = 0))
174                   (r1 += r2)               ((r2 = (r1 & #x7F))
175                   (r1 += ,(- #xe000 (* 32 96) 32))                (r1 >>= 7)
176                   (r1 >8= 0)                (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
177                   (r2 = r7)))))))))                    ((r1 *= 96)
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
207  (setq font-ccl-encoder-alist  (setq font-ccl-encoder-alist
208        (cons '("ISO10646-1" . ccl-encode-unicode-font)        (cons '("ISO10646.*-*" . ccl-encode-unicode-font)
209              font-ccl-encoder-alist))              font-ccl-encoder-alist))
210    
211  ;; Setting for suppressing XLoadQueryFont on big fonts.  ;; Setting for suppressing XLoadQueryFont on big fonts.

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26