| 您的位置:首页 > 文档 > 解决方案 > |
文章分类热门文章 |
Slackware 9 ghostscript/gv 中文解决方案创建:2005-11-07 00:00:00 作者:Unlinux 来自: http://www.Unlinux.com 摘要 This is a Chinese printing and view quick solution for Slackware Linux 9 and -current (if anyone still use Slackware). I try to keep it simple and stupid (KISS).(2003-12-07 11:13:36) By terminator (1) Software requirements: Install ghostscript (espgs-7.05.6), font (gnu-gs-fonts) and ghostview (gv) packages (2) Font requirements: Install SimSun, SimHei and other Chinese TTF fonts to XFree86 TTF font dir (3) Hack the ghostscript: Backup file /usr/share/ghostscript/7.05/lib/CIDFnmap, then modify it as follows: %(CIDFnmap.Win) .runlibfile % Add the following line (CIDFnmap.zhcn) .runlibfile Add file /usr/share/ghostscript/7.05/lib/CIDFnmap.zhcn as follows: /SimSun (/usr/X11R6/lib/X11/fonts/TTF/simsun.ttc) ; /STSong-Light /SimSun ; /Beijing /SimSun ; %/NSimSun (/usr/X11R6/lib/X11/fonts/TTF/simsun.ttc) 2 ; /Adobe-GB1 /SimSun ; /SimHei (/usr/X11R6/lib/X11/fonts/TTF/simhei.ttf) ; /STHeiti-Regular /SimHei ; /SimFang (/usr/X11R6/lib/X11/fonts/TTF/simfang.ttf) ; /FangSong /SimFang ; /STFangsong-Light /SimFang ; /SimKai (/usr/X11R6/lib/X11/fonts/TTF/simkai.ttf) ; /KaiTi /SimKai ; /STKaiti-Regular /SimKai ; /FZFangSong (/usr/X11R6/lib/X11/fonts/TTF/fzfsjw.ttf) ; /FZWeiBei (/usr/X11R6/lib/X11/fonts/TTF/fzwbjw.ttf) ; /FZKai (/usr/X11R6/lib/X11/fonts/TTF/fzktjw.ttf) ; /FZShuTi (/usr/X11R6/lib/X11/fonts/TTF/fzstjw.ttf) ; /SIL-FangSong- /STFangsong-Light ; /SIL-FangSong-Reg-Jian /STFangsong-Light ; /SIL-Hei-Med-Jian /STHeiti-Regular ; /SIL-Kai- /STKaiti-Regular ; /SIL-Kai-Reg-Jian /STKaiti-Regular ; /SIL-Song-Reg-Jian /STSong-Light ; Backup /usr/share/ghostscript/7.05/lib/gs_res.ps, then modify it as follows: Find the following line /GenericResourceDir (/usr/share/ghostscript/) readonly .forcedef Replace it with the following line /GenericResourceDir (/usr/share/ghostscript/resource/) readonly .forcedef (4) Add Adobe CMAP for CID fonts to ghostscript Download ac14.tar.Z and ag14.tar.Z from the following link: ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/ Execute the following commands: # cd /usr/share/ghostscript/ # mkdir resource # cd resource # mkdir CMap # tar -zxvf /tmp/ac14.tar.Z # tar -zxvf /tmp/ag14.tar.Z # cp ac14/CMap/* ag14/CMap/* CMap # rm -rf ac14 ag14 Alternatively, if you want the latest Adobe CMAP files, download "Complete set of Adobe CMAP files for CID Fonts" in the "Adobe Font Development Kit for OpenType" from adobe.com: http://partners.adobe.com/asn/tech/type/otfdk/index.jsp Execute the following commands: # cd /usr/share/ghostscript/ # mkdir resource # cd resource # mkdir CMap # unzip /tmp/Adobe Cmaps.zip # cp Adobe Cmaps/Adobe-CNS1-2/* Adobe Cmaps/Adobe-CNS1-3/* Adobe Cmaps/Adobe-CNS1-4/* Adobe Cmaps/Adobe-GB1-3/* Adobe Cmaps/Adobe-GB1-4/* Adobe Cmaps/Adobe-Identity-0/* CMap # rm -rf Adobe Cmaps (5) Hack Mozilla/Firebird preference file: Modify mozilla/default/pref/unix.js as follows: Look for the following line: pref("print.postscript.nativefont.zh-CN", ""); Replace it with the following line: pref("print.postscript.nativecode.zh-CN", "gb2312"); pref("print.postscript.nativefont.zh-CN", "SimSun-GB-EUC-H"); 网友:terminator 发表时间:2003-12-12 15:55:56 One more note for the solution: To print Chinese webpage, one way is to print to mozilla.ps, then distiller mozilla.ps and send the output.ps to printer: % ps2ps mozilla.ps output.ps % lpr output.ps Note, directly sending mozilla.ps to printer will not work!!! Another way to print Chinese webpage directly is to change the Mozilla preference again: Look for the following line: pref("print.print_command", "lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}"); Replace it with for the following line: pref("print.print_command", "ps2ps mozilla.ps output.ps; lpr output.ps"); 网友:terminator 发表时间:2003-12-18 04:43:54 Finally I figure out the problem why mozilla cannot print Chinese webpage directly. It seems to be a bug in ghostscript (in my opinion): although we specify the full path of TTF fonts in CIDFnmap.zhcn, ghostscript has trouble to use it in printing. So the solution is like this: (1) Remove the full path in CIDFnmap.zhcn: /usr/X11R6/.../simsun.ttc -> simsun.ttc (2) Make symbol link of TTF fonts in the ghostscript font directory: cd /usr/share/ghostscript/fonts/; ln -s /usr/X11R6/.../sim* . 网友:lazy 发表时间:2003-12-19 04:36:43 Tried this on redhat 9 + mozilla 1.5 I need to set the mozilla preference "print.postscript.nativefont.zh-CN" to "SimSun-GBK-EUC-H". Then it works. Thanks! 网友:alygunia 发表时间:2004-01-06 02:31:56 Using your CIDnmap.zhcn, I got following Error message: While reading gs_cidfn.ps: Error: /invalidfileaccess in --file-- Operand stack: (gs_cidfn.ps) 1 --dict:26/38(G)-- --nostringval-- (CIDFnamp.zhcn) Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- Dictionary stack: --dict:838/1417(G)-- --dict:0/20(G)-- --dict:62/200(L)-- --dict:838/1417(G)-- Current allocation mode is global Last OS error: 2 Current file position is 16233 转载自:http://www.unlinux.com/doc/solution/20051107/8933.html 【评论】 【加入收藏夹】 【大 中 小】 【打印】 【关闭】 ※ 相关链接
|