Ubuntu 10.04下Evince汉字显示方框或者无法显示解决。Evince 原本是 GNOME 环境中一个简单的文档查看器,不过用来阅读 PDF 格式的电子书倒也不错。窃以为,Evince 虽无 Adobe 本家之 Acrobat Reader 庞大,却有执行快速、资源占用少之优点;而与系统中另一个“古董级”的 Xpdf 相比,在界面外观上自然要亮眼些,在操作使用上也要便当些。现在看来,实为偶家的不二之选。
Evince 支持阅读包括英文、中文等在内的多种语言的 PDF 文档,个人认为其效果要好过 Xpdf。且对于追求速度的用户来说,可作为 Acrobat Reader 的替代。有此需求的朋友不妨一试。
分两步:
1.apt-get install poppler-data
其中包含cmap-adobe-gb1
CMap files for Adobe-GB character collection, which stands for Adobe-defined one, and including standard Simplified-Chinese charsets.
2.编辑/etc/fonts/conf.d/49-sansserif.conf 为
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!--
If the font still has no generic name, add sans-serif
-->
<match target="pattern">
<test qual="all" compare="not_eq">
<string>sans-serif</string>
</test>
<test qual="all" compare="not_eq">
<string>serif</string>
</test>
<test qual="all" compare="not_eq">
<string>monospace</string>
</test>
<edit mode="append_last">
<!-- <string>sans-serif</string> -->
<string>文泉驿正黑</string>
</edit>
</match>
</fontconfig>
注意红色的字体,换成你希望的中文字体名。
再打开pdf文件看看。
其实也可以不改/etc/fonts/conf.d/49-sansserif.conf,而改/etc/fonts/conf.d/69-language-selector-zh-cn.conf,将你希望要的汉字在sansserif字段中提前。
最终69-language-selector-zh-cn.conf的文件内容可能如下:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any">
<string>serif</string>
</test>
<edit mode="prepend" binding="strong">
<string>DejaVu Serif</string>
<string>Bitstream Vera Serif</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>WenQuanYi Bitmap Song</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>sans-serif</string>
</test>
<edit mode="prepend" binding="strong">
<string>WenQuanYi Zen Hei</string>
<string>WenQuanYi Micro Hei</string>
<string>DejaVu Sans</string>
<string>Bitstream Vera Sans</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>monospace</string>
</test>
<edit mode="prepend" binding="strong">
<string>DejaVu Sans Mono</string>
<string>Bitstream Vera Sans Mono</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>WenQuanYi Zen Hei Mono</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
</fontconfig>