summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-09-30 06:41:01 +0000
committerKenichi Handa <handa@m17n.org>2002-09-30 06:41:01 +0000
commit84fa2951d989afa98a4d770807deca14adb22550 (patch)
treec9e4224cb0d4c077186a48b62d118a1a1e4ae11c
parent06859d9e51377e71943da476a80c7b3da03a18fe (diff)
downloademacs-84fa2951d989afa98a4d770807deca14adb22550.tar.gz
emacs-84fa2951d989afa98a4d770807deca14adb22550.tar.bz2
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.el87
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 @@
(set-font-encoding "ISO8859-1" 'ascii 0)
(set-font-encoding "JISX0201" 'latin-jisx0201 0)
+;; Allow display of arbitrary characters with an iso-10646-encoded
+;; (`Unicode') font.
+(define-translation-table 'ucs-mule-to-mule-unicode
+ ucs-mule-to-mule-unicode)
+(define-translation-hash-table 'ucs-mule-cjk-to-unicode
+ ucs-mule-cjk-to-unicode)
+
(define-ccl-program ccl-encode-unicode-font
`(0
- (if (r0 == ,(charset-id 'ascii))
- ((r2 = r1)
- (r1 = 0))
- (if (r0 == ,(charset-id 'latin-iso8859-1))
- ((r2 = (r1 + 128))
- (r1 = 0))
- (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
- ((r1 *= 96)
- (r1 += r2)
- (r1 += ,(- #x100 (* 32 96) 32))
- (r1 >8= 0)
- (r2 = r7))
- (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
- ((r1 *= 96)
- (r1 += r2)
- (r1 += ,(- #x2500 (* 32 96) 32))
- (r1 >8= 0)
- (r2 = r7))
- (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
- ((r1 *= 96)
- (r1 += r2)
- (r1 += ,(- #xe000 (* 32 96) 32))
- (r1 >8= 0)
- (r2 = r7)))))))))
-
+ ;; r0: charset-id
+ ;; r1: 1st position code
+ ;; r2: 2nd position code (if r0 is 2D charset)
+ ((if (r0 == ,(charset-id 'ascii))
+ ((r2 = r1)
+ (r1 = 0))
+ ;; At first, try to get a Unicode code point directly.
+ ((if (r2 >= 0)
+ ;; This is a 2D charset.
+ (r1 = ((r1 << 7) | r2)))
+ (lookup-character ucs-mule-cjk-to-unicode r0 r1)
+ (if r7
+ ;; We got it!
+ ((r1 = (r0 >> 8))
+ (r2 = (r0 & #xFF)))
+ ;; Look for a translation for non-ASCII chars.
+ ((translate-character ucs-mule-to-mule-unicode r0 r1)
+ (if (r0 == ,(charset-id 'latin-iso8859-1))
+ ((r2 = (r1 + 128))
+ (r1 = 0))
+ ((r2 = (r1 & #x7F))
+ (r1 >>= 7)
+ (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
+ ((r1 *= 96)
+ (r1 += r2)
+ (r1 += ,(- #x100 (* 32 96) 32))
+ (r1 >8= 0)
+ (r2 = r7))
+ (if (r0 == ,(charset-id 'mule-unicode-2500-33ff))
+ ((r1 *= 96)
+ (r1 += r2)
+ (r1 += ,(- #x2500 (* 32 96) 32))
+ (r1 >8= 0)
+ (r2 = r7))
+ (if (r0 == ,(charset-id 'mule-unicode-e000-ffff))
+ ((r1 *= 96)
+ (r1 += r2)
+ (r1 += ,(- #xe000 (* 32 96) 32))
+ (r1 >8= 0)
+ (r2 = r7))
+ ;; No way, use the glyph for U+FFFD.
+ ((r1 = #xFF)
+ (r2 = #xFD)))))))))))))
+ "Encode characters for display with iso10646 font.
+Translate through the translation-hash-table named
+`ucs-mule-cjk-to-unicode' and the translation-table named
+`ucs-mule-to-mule-unicode' initially.")
+
+;; Use the above CCL encoder for Unicode fonts. Please note that the
+;; regexp is not simply "ISO10646-1" because there exists, for
+;; instance, the following Devanagari Unicode fonts:
+;; -misc-fixed-medium-r-normal--24-240-72-72-c-120-iso10646.indian-1
+;; -sibal-devanagari-medium-r-normal--24-240-75-75-P--iso10646-dev
(setq font-ccl-encoder-alist
- (cons '("ISO10646-1" . ccl-encode-unicode-font)
+ (cons '("ISO10646.*-*" . ccl-encode-unicode-font)
font-ccl-encoder-alist))
;; Setting for suppressing XLoadQueryFont on big fonts.