[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: unicode font



矢木です。

色々と試してみた結果、表示ルーチンがバグっているのでフォント設定だけで
latin-iso8859-2 などの文字集合にユニコードの BDF フォントを表示させる事
は無理だと言う結論に達しました。

それで display-table を使ってお茶を濁そうと考えたのですが、
まだ問題があります。

・buffer-display-table の説明にある
    For example, (aset buffer-display-table ?X ?Y) will cause Emacs to display
    a capital Y instead of each X character.
  が文字そのものを指定してもダメで (vector ?Y) の形にしないと有効にならない
・C-h h で Lao の文字のうち compose されたものが表示されない。
・その表示されない Lao の文字の所で C-u C-x = (what-cursor-position) を入力
  するとエラーになる

japanese-jisx0208 に encode-unicode-font を指定しても何も表示されない問題は
r3945 で解決しているみたいですが、¢£§はやっぱり表示されません。

おわり
(let* ((size 16) ;; one of 10, 12, 14, 16, 24
       (dir "c:/app/fonts/bdf/efont-unicode-bdf-0.4.2/")
       (name (format "efont-%d" size))
       (csl '(ascii latin-iso8859-1 mule-unicode-0100-24ff
                    mule-unicode-2500-33ff mule-unicode-e000-ffff
                    japanese-jisx0208 japanese-jisx0212 korean-ksc5601
                    chinese-gb2312 chinese-big5-1 chinese-big5-2))
       (fun (lambda (cs)
              (let* ((encoding (cond ((eq cs 'ascii) nil)
                                     ((eq cs 'latin-iso8859-1) '1-byte-set-msb)
                                     (t 'encode-unicode-font)))
                     (fun (lambda (bold-p italic-p)
                            `((:char-spec ,cs :height any
                                          ,@(if bold-p '(:weight bold))
                                          ,@(if italic-p '(:slant italic)))
                              strict
                              (bdf-font
                               ,(expand-file-name
                                 (format "%s%d%s.bdf"
                                         (if (= 2 (charset-width cs)) "f" "h")
                                         size
                                         (if bold-p
                                             (if italic-p "_bi" "_b")
                                           (if italic-p "_i" "")))
                                 dir))
                              ((encoding . ,encoding)))
                            )))
                (list (funcall fun nil nil)
                      (funcall fun t nil)
                      (funcall fun nil t)
                      (funcall fun t t))))))
  (funcall (if (w32-list-fonts name) 'w32-change-font 'w32-add-font) name
           `((spec ,@(apply #'nconc (mapcar fun csl)))))
  (let ((utable (get 'utf-translation-table-for-encode 'translation-table))
        (default-char (make-char 'mule-unicode-e000-ffff 117 61)))
    (mapcar (lambda (cs)
              (when (and (eq 1 (charset-dimension cs))
                         (eq 1 (charset-width cs)))
                (let ((i (if (= 96 (charset-chars cs)) 32 33))
                      (max (if (= 96 (charset-chars cs)) 127 126))
                      c)
                  (while (<= i max)
                    (setq c (make-char cs i)
                          i (1+ i))
                    (aset standard-display-table c
                          (vector (or (aref utable c) default-char)))))))
            '(latin-iso8859-2
              latin-iso8859-3 latin-iso8859-4 cyrillic-iso8859-5
              arabic-iso8859-6 greek-iso8859-7 hebrew-iso8859-8
              latin-iso8859-9 latin-iso8859-14 latin-iso8859-15
              chinese-sisheng ipa lao thai-tis620 katakana-jisx0201
              vietnamese-viscii-lower vietnamese-viscii-upper)))
  (set-frame-font name))