註:因為okular, epdfview, evince的pdf功能均由xpdf的分支poppler提供,所以這裡以poppler來代稱這些軟體。kpdf下沒有測試過,因為我現在直接用okular。
poppler官方網站:http://poppler.freedesktop.org/
和很朋友一樣,poppler的亂碼是我最不願意看到的。
後來我看了軟體依賴情況,認識到okular等都是以poppler為後端。
poppler的官方有如下說明:
http://freedesktop.org/wiki/Software/poppler
QUOTE:
Suggested Fontconfig font substitutions
Poppler is using fontconfig to do the font searching on the system for fonts that are not embedded into the pdf files. This is a list of recommended font substitutions that distributions/users should have in their fontconfig configuration
也就是說,poppler從fontconfig的設定檔中讀取字型取代pdf裡的字型。於是,我們也只需要配好了字型替代就可以了。這一點和openoffice裡相似,openoffice除了接受他自己的字型替代外,也接受這種fontconfig的字型替代。
如果你已經裝了很多windows的字型,基本上你不會有亂碼的情況。如果你沒有裝,就要字型替代了。上文的官方wiki提供了替代的方法,當然前提是你安裝了poppler-data,否則還是無法顯示中文。
下面給出我的設定檔。
為所有中文指定一個或幾個字型
CODE:
<match target="font">
<test name="lang" equal="any" compare="eq">
<string>zh</string> <!--指定語言,另外也可以為ja, ko指定-->
</test>
<edit name="spacing">
<const>proportional</const>
</edit>
<edit name="globaladvance">
<bool>false</bool>
</edit>
<edit name="family" mode="prepend" binding="strong"><!--這裡用的是strong-->
<string>AR PL ShanHeiSun Uni</string><!--我的中文字型-->
</edit>
</match>
單獨為用楷體情況指定
CODE:
<match target="pattern">
<test name="family">
<string>KaiTi_GB2312</string>
<string>STXingkai</string>
<string>STXinwei</string>
</test>
<edit name="family" mode="prepend" binding="same">
<string>AR PL ZenKai Uni</string>
</edit>
</match>
當然,我還把我中文字型裡的英文換成漂亮的英文字型。
更正:kpdf不是以poppler為後端。