请问如何配置Emacs打印中文
发表于 : 2012-07-01 9:42
直接给配置就好,print和ps-print的设置都没有整出中文,打印时还是方块。不知道该怎么办了。
主程序文件编码指定为 UTF-8,PS打印驱动字体为GB2312,编码不统一,当然乱码。code vampire 写了:系统是UBUNTU10.04,Emacs24自己编译的。
配置中关于编码,字体的部分,我的是这样的。
(set-default-font "WenQuanYi Micro Hei Mono-15")
(set-language-environment 'UTF-8)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(setq-default pathname-coding-system 'utf-8)
关于打印的配置
(require 'ps-print)
(setq ps-paper-type 'a4
ps-font-size 8.25
ps-print-header nil
ps-landscape-mode nil)
(require 'ps-mule)
(setq ps-multibyte-buffer 'bdf-font)
(setq bdf-directory-list '("/home/codevampire/.emacs.d/fonts"))
(setq ps-mule-font-info-database-bdf '((chinese-gb2312 (normal bdf "gb24st.bdf.bdf") (bold bdf "gb24st.bdf.bdf") (italic bdf "gb24st.bdf.bdf") (bold-italic bdf "gb24st.bdf.bdf"))))
打印输出,中文时为?
;; This buffer is for notes you don’t want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C−x C−f,
;; then enter the text in that file’s own buffer.
?????
careone 写了:主程序文件编码指定为 UTF-8,PS打印驱动字体为GB2312,编码不统一,当然乱码。code vampire 写了:系统是UBUNTU10.04,Emacs24自己编译的。
配置中关于编码,字体的部分,我的是这样的。
(set-default-font "WenQuanYi Micro Hei Mono-15")
(set-language-environment 'UTF-8)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(modify-coding-system-alist 'process "*" 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(setq-default pathname-coding-system 'utf-8)
关于打印的配置
(require 'ps-print)
(setq ps-paper-type 'a4
ps-font-size 8.25
ps-print-header nil
ps-landscape-mode nil)
(require 'ps-mule)
(setq ps-multibyte-buffer 'bdf-font)
(setq bdf-directory-list '("/home/codevampire/.emacs.d/fonts"))
(setq ps-mule-font-info-database-bdf '((chinese-gb2312 (normal bdf "gb24st.bdf.bdf") (bold bdf "gb24st.bdf.bdf") (italic bdf "gb24st.bdf.bdf") (bold-italic bdf "gb24st.bdf.bdf"))))
打印输出,中文时为?
;; This buffer is for notes you don’t want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C−x C−f,
;; then enter the text in that file’s own buffer.
?????
试着统一改为 UTF-8或 GB2312(从字体库判断,建议把文件编码改为GB2312可行性高点),再试试
代码: 全选
;; print setting
(setq ps-multibyte-buffer 'bdf-font-except-latin)
;; sudo apt-get install emacs-intl-fonts
;; 在 ubuntu 里字体的位置不是默认的
;; /usr/local/share/emacs/fonts/bdf
;; 而是
;; /usr/share/emacs/fonts/bdf
(add-to-list 'bdf-directory-list "/usr/share/emacs/fonts/bdf")
(setq ps-paper-type 'a4 ;; default lettle
ps-font-family 'Courier ;; default Courier
ps-font-size 8.8 ;; default 8.5
ps-print-header nil ;; default t
ps-header-lines 2 ;; default 2
ps-landscape-mode nil) ;; default nil