MacOS X 下的 Carbon Emacs 處理中文問題

使用 TrueType 字體顯示中文還是很漂亮的。原來挺鬱悶的是 Carbon Emacs 顯示日文字體挺漂亮,但中文總是顯得土土的。想想基本沒有中國人參與 Emacs 的開發,人家能夠支持你中文已經不錯了。唉,這種吃力的事情國人顯然是不願意做的。不過,只要稍做修改,也就行了。
問題基本解決,這兒是我的 MacOSX-env.el 文件內容,保存一份:
--------
(when (string-match "mac" (prin1-to-string window-system))

;;
;; For displaying Chinese with Enhanced Carbon Emacs on MacOS X
;;
(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'chinese-iso-8bit-mac)
(set-clipboard-coding-system 'chinese-iso-8bit-mac)
;; 使用 utf-translate-cjk 方式顯示 UTF-8 文件
(utf-translate-cjk-mode)
(set-buffer-file-coding-system 'utf-8)

;; 目前 Enhanced Carbon Emacs 還不支持 BDF 字體,故此段代碼無用。
;; (setq font-dir "~/.emacs.d/fonts/")
;; (setq intlfonts-dir
;; (expand-file-name "intlfonts-1.2.1/" font-dir))

;; (setq bdf-directory-list
;; (list
;; (expand-file-name "Asian" intlfonts-dir)
;; (expand-file-name "Chinese" intlfonts-dir)
;; (expand-file-name "Chinese.BIG" intlfonts-dir)
;; (expand-file-name "Chinese.X" intlfonts-dir)
;; (expand-file-name "Ethiopic" intlfonts-dir)
;; (expand-file-name "European" intlfonts-dir)
;; (expand-file-name "European.BIG" intlfonts-dir)
;; (expand-file-name "Japanese" intlfonts-dir)
;; (expand-file-name "Japanese.BIG" intlfonts-dir)
;; (expand-file-name "Japanese.X" intlfonts-dir)
;; (expand-file-name "Korean.X" intlfonts-dir)
;; (expand-file-name "Misc" intlfonts-dir)
;; (expand-file-name "TrueType" intlfonts-dir)
;; (expand-file-name "Type1" intlfonts-dir)
;; (expand-file-name "ucs-fonts" font-dir)))

;; 針對 MacOS X 的字體,創建新的 fontsets
;; 1. simsun 12pt 的小字體:
(create-fontset-from-fontset-spec
"-apple-simsun-medium-r-normail-*-12-*-*-*-*-*-fontset-simsun1,
ascii:-apple-courier-medium-r-normal--12-120-75-75-m-120-mac-roman,
chinese-gb2312:-apple-simsun-medium-r-normal--12-0-75-75-m-0-gb2312.1980-0")
;; 2. simsun 14pt 的大字體:
(create-fontset-from-fontset-spec
"-apple-simsun-medium-r-normail-*-14-*-*-*-*-*-fontset-simsun2,
ascii:-apple-courier-medium-r-normal--14-140-75-75-m-140-mac-roman,
chinese-gb2312:-apple-simsun-medium-r-normal--14-0-75-75-m-0-gb2312.1980-0")
;; 3. 宋體 12pt 的小字體:
(create-fontset-from-fontset-spec
"-apple-song-medium-r-normal-*-12-*-*-*-*-*-fontset-song1,
ascii:-apple-courier-medium-r-normal--12-120-75-75-m-120-mac-roman,
chinese-gb2312:-apple-song-medium-r-normal--12-120-75-75-m-120-gb2312.1980-0")
;; 4. 宋體 14pt 的強制顯示,英文 14pt 的中等字體:
(create-fontset-from-fontset-spec
"-apple-song-medium-r-normal-*-14-*-*-*-*-*-fontset-asong2,
ascii:-apple-courier-medium-r-normal--14-140-75-75-m-140-mac-roman,
chinese-gb2312:-apple-song-medium-r-normal--14-160-75-75-m-160-gb2312.1980-0")
;; 5. 宋體 16pt,英文 18pt 的大字體:
(create-fontset-from-fontset-spec
"-apple-song-medium-r-normal-*-14-*-*-*-*-*-fontset-asong3,
ascii:-apple-courier-medium-r-normal--18-180-75-75-m-180-mac-roman,
chinese-gb2312:-apple-song-medium-r-normal--16-160-75-75-m-160-gb2312.1980-0")
;; 6. 黑 12pt 小字體:
(create-fontset-from-fontset-spec
"-apple-hei-medium-r-normal-*-12-*-*-*-*-*-fontset-hei1,
ascii:-apple-courier-medium-r-normal--12-120-75-75-m-120-mac-roman,
latin-iso8859-1:-apple-courier-medium-r-normal--12-120-75-75-m-120-mac-roman,
chinese-gb2312:-apple-hei-medium-r-normal--12-120-75-75-m-120-gb2312.1980-0")
;; 7. 黑 14pt 中等字體:
(create-fontset-from-fontset-spec
"-apple-hei-medium-r-normal-*-16-*-*-*-*-*-fontset-hei2,
ascii:-apple-courier-medium-r-normal--14-140-75-75-m-140-mac-roman,
chinese-gb2312:-apple-hei-medium-r-normal--14-160-75-75-m-0-gb2312.1980-0")
;; 8. 黑 16pt,英文 18pt 的大字體:
(create-fontset-from-fontset-spec
"-apple-hei-medium-r-normal-*-16-*-*-*-*-*-fontset-hei3,
ascii:-apple-courier-medium-r-normal--18-180-75-75-m-180-mac-roman,
latin-iso8859-1:-apple-courier-medium-r-normal--18-180-75-75-m-180-mac-roman,
chinese-gb2312:-apple-hei-medium-r-normal--16-160-75-75-m-0-gb2312.1980-0")
;; 9. simhei 12pt 小字體:
;; 10. simhei 14pt 中等字體:
;; 11. simhei 16pt 大字體:

;; 選用默認的字符集:
(set-default-font "fontset-simsun2")

;;
;; 針對 MacOS X Carbon Emacs 的特殊設置
;;

;; 由於 Carbon Emacs 默認將 ps-postscript-code-directory 設置成
;; "/User/franconi/Software/emacs/emacs/etc/" 從而導致無法正常打印文檔。
;; 這是編譯者的默認設置問題。
;; 此代碼設置打印的 ps 代碼路徑,解決無法打印文檔的問題
(setq ps-postscript-code-directory data-directory)

)

--------
arrow
arrow
    全站熱搜

    Bluelove1968 發表在 痞客邦 留言(0) 人氣()