歡迎您光臨本站 註冊首頁

Fedora 8 中字體設置的學習

←手機掃碼閱讀     火星人 @ 2014-03-25 , reply:0

原創:gcell
Fedora 8中字體設置方法有好幾種,有三大件的《Fedora 8中文的字體設置技巧》,不過被盾了,需要帶tor瀏覽,這個是從源代碼開始整的,看過之後應該會對linux字體的處理有所了解,作者還提供了已經編譯好的rpm包下載,應該說還是有用的,不過我試了效果不明顯,需要的朋友去看看吧。

另一種:普適版的字體安裝方法(這個方法好像流傳比較廣):

創建字體目錄,並拷貝字體文件到創建的目錄
#mkdir -p 自定義目錄 一般在/usr/share/fonts目錄下新建比較合理
#cp -f 字體位置 目標位置
進入自定義目錄,建立fonts.scale文件和生成字體目錄索引
#cd /usr/share/fonts/custom
#ttmkfdir -o fonts.scale 建立fonts.scale文件
#mkfontdir 生成字體目錄索引
#fc-cache -fv 更新字體緩存信息

這個方法對於很多字體都有效果,但是字體多少會有很多小問題,尤其是類似雅黑等truetype字體的顯示效果令人不爽,這時候就需要對字體進行微調:

fontconfig字體調配法-《Linux 字體微調- windows 效果版- LinuxSir.Org》 和《Linux 字體微調 - Vista 效果版》。

讀了不少這方面的文章,我把自己安裝使用某黑字體的學習體會寫出來供大家參考,也是給自己做個記錄:

首先,將某黑字體下載后按照普適版的字體安裝方法進行安裝,最重要的是進行微調,輯/etc/fonts/local.conf文件,對字體進行配置。

關於這個文件的配置方法參見:《fontconfig用戶手冊》?譯者:Conner Mo 文章好像是linuxfans.org翻譯的,但是排版實在是太丑了,因此我選擇了排版比較好的linux技術中堅站的版本,文中對於 local.conf文件的配置語法和參數描述的很詳細,使用local.conf可以實現對字體的部分替換,例如某字體的中文顯示效果很好,但是英文很 丑,就可以將你中意的英文字體引入替換原有字體的英文部分;可以實現系統調用不同字體的時候自動進行不同種類的渲染和微調,比如有兩種字體,一種需要渲 染,一種不需要,就可以分別設置,十分靈活,而且針對性強,可以精確到字體-字型大小或者其他符合的條件。

略有編程基礎的兄弟應該很容易看明白設置,如果要實現更好更精確的效果,則需對這個文檔研究透徹點。

關於某黑字體的具體設置參見:fontconfig字體調配法-《Linux 字體微調- windows 效果版- LinuxSir.Org》 和《Linux 字體微調 - Vista 效果版》會有更多收穫!

如果你比較懶也可以直接使用我的local.conf文件內容,不過本人也是半吊子水平,因此不對local.conf文件負責,不過如果有問題,可以上IRC問人,那裡的兄弟都是很熱心的:

local.conf文件:
CODE:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
<match target="pattern">
<edit name="dpi" mode="assign" >
<double>96</double>
</edit>
</match>

<!-- 配置字體目錄 -->
<dir>/usr/share/fonts/zh_CN/vista</dir>

<!-- 配置雅黑字體
<match target="font">
<test name="family" qual="any" compare="eq">
<string>微軟雅黑</string>
<string>Microsoft YaHei</string>
</test>
<test compare="more_eq" name="pixelsize">
<double>12</double>
</test>
<test compare="less_eq" name="pixelsize">
<double>18</double>
</test>
<edit name="rgba" mode="assign">
<const>vrgb</const>
</edit>
<edit name="antialias" mode="assign" >
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign" >
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign" >
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign" >
<const>hintfull</const>
</edit>
</match>
-->
<match target="font" >
<test qual="any" name="family" compare="eq" >
<string>none</string>
</test>
<edit name="rgba" mode="assign">
<const>vrgb</const>
</edit>
<edit name="antialias" mode="assign" >
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign" >
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign" >
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign" >
<const>hintfull</const>
</edit>
</match>
<!-- 配置 -->
<match target="font" >
<test qual="any" name="family" compare="eq" >
<string>Segoe UI</string>
</test>
<edit name="rgba" mode="assign">
<const>none</const>
</edit>
<edit name="antialias" mode="assign" >
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign" >
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign" >
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign" >
<const>hintfull</const>
</edit>
</match>
<!--
已註釋,不會被讀取
English portion substitution 將指定字體中的英文字體替換成Segoe UI字體
<match target="pattern" >
<test name="family" >
<string>微軟雅黑</string>
<string>Microsoft YaHei</string>
</test>
<edit name="family" mode="prepend" binding="strong" >
<string>Segoe UI</string>
</edit>
</match>
<match target="pattern" >
<test name="family" >
<string>微軟雅黑</string>
<string>Microsoft YaHei</string>
</test>
<edit name="family" mode="prepend" binding="strong" >
<string>Segoe UI</string>
</edit>
</match>
-->
</fontconfig>

總而言之,如果掌握了fontconfig,那麼字體的美化和微調就真是易如反掌了,相信到那個時候你一定會有一覽眾山小的感覺!

[火星人 ] Fedora 8 中字體設置的學習已經有500次圍觀

http://coctec.com/docs/linux/show-post-167790.html