Ubuntu/字體
字體基本知識
[編輯]字符編碼與字體
[編輯]計算機有自身的字符編碼來表示字符。如ASCII中,十六進制數字41表示字母A。字符編碼不能直接被顯示為字符,就像41隻能以二進制存儲,不能顯示為A。因此需要用到字體作為圖形化顯示、打印的媒介,將41映射到A。
對於一種字體,其每一個字符圖形對應一個字符編碼;而反過來則不一定,一個字符編碼不一定能在此字體中找到對應的字符圖形。通常一種字體是針對某一些語言設計的,所以需要適當的字體才能準確顯示特定語言的內容。比如Libretion Sans字體只包含了拉丁字符,故不能顯示中文字符。中文字體如文泉驛正黑能顯示中文字符,這就是我們需要中文字體的原因。
矢量字體
[編輯]字體可分為點陣字體和矢量字體。點陣字體放大會產生鋸齒,而矢量字體則可以保持平滑。
矢量字體是矢量圖形,然而最終以位圖形式顯示在屏幕上。從矢量字體生成位圖的過程叫做字體渲染。字體渲染的方法不同,會導致同一字體渲染的效果不同。Ubuntu和Windows 7的字體渲染效果不同是因為它們採用了不同的渲染方法:Windows 7字體銳利清晰;Ubuntu字體平滑美觀。
字體文件
[編輯]字體是以字體文件形式存在的。TrueType矢量字體通常以.ttf結尾,是最常用的,被廣泛支持的矢量字體格式。
在Ubuntu中,雙擊打開字體文件,即可用」字體察看器「打開,選擇安裝。安裝字體其實是將字體文件複製到家目錄的 .fonts 文件夾中了。該字體僅僅能被當前用戶使用,而對其他用戶無影響,屬於用戶字體。若想添加系統字體,需要將字體複製到 /usr/share/fonts/ 文件夾中。若要刪除字體,只要刪除對應的字體文件即可。
字體版權
[編輯]和繪畫、音樂一樣,字體也是擁有版權的。雖然大多數時候,您可以在未收到提醒的情況下直接安裝字體,但並不意味着這樣是合法的。
如果您要在自己的計算機上安裝Windows系統字體,請確保您擁有此Windows系統的正版許可。該許可允許您在此計算機上使用這些字體。若您沒有正版許可,那麼這樣做是不被允許的。
如果您想在計算機上安裝受版權保護的字體,則必須購買使用許可。
Ubuntu系統字體均是自由授權的,您可以免費使用,並在Ubuntu軟件中心中下載安裝其他字體。比較受歡迎的中文字體有文泉驛系列字體,文鼎開源字體。
默認字體
[編輯]系統擁有默認字體。在沒有特別說明的情況下,就以此字體為默認顯示。默認字體即將字體按照優先級排序,排序結果即默認字體順序。
襯線字體
[編輯]Serif,襯線字體,是一個字體族而非一種字體。當選擇字體為Serif時,會顯示Serif族默認字體,也就是默認襯線字體。襯線字體適合打印,而不適合液晶屏幕顯示。
無襯線字體
[編輯]Sans Serif,或 Sans,無襯線字體,是一個字體族而非一種字體。當選擇字體為Sans Serif時,會顯示Sans Serif族默認字體,也就是默認無襯線字體。無襯線字體適合屏幕顯示,而不適合打印。
等寬字體
[編輯]Monospace,或Mono,等寬字體,意思是每個字符寬度相同(一個中文字符寬度等於兩個英文字符)。當選擇Monospace時,會顯示Monospace族默認字體,也就是默認等寬字體。等寬字體適合顯示程序代碼等需要對齊字符的文本。
字體替換
[編輯]如果所選字體無法顯示當前字符,或者排在第一位的默認字體不能顯示此字符的時候,系統會按照優先級尋找能夠顯示此字符的字體。因此,除非所有安裝字體都無法顯示此字符,系統總能找出對應的字體顯示。
配置字體
[編輯]字體配置有兩種形式,系統配置和用戶配置。
系統配置更改系統配置文件,保存在/etc/fonts/fonts.conf文件中,作用影響每個用戶。
用戶配置更改用戶配置文件,保存在家目錄~/.fonts.conf文件中,僅影響此用戶設置。
用戶配置的優先級高於系統配置,因此當有用戶配置時,會優先依照用戶配置。出於安全性和可操作性考慮,建議使用用戶配置。
用戶配置
[編輯]用戶配置即修改家目錄中的.fonts.conf文件。這個文件默認是沒有創建的,您需要新建此配置文件。
接下來就是要對各種字體進行優先級排序,分為三類:Sans,Serif,Mono。
文泉驛提供了一個簡便的在線配置工具,可方便生成配置內容:
http://wenq.org/cloud/fcdesigner_local.html
拖動字體排序,完成後點擊生成按鈕,即可自動生成配置文件內容。將內容複製到.fonts.conf文件中,保存在家目錄,完成配置。結果會立即生效,無需重啟計算機。
也可按照下面的例子手動編輯,但過程較為繁瑣:
.fonts.conf |
---|
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- created by WenQuanYi FcDesigner v0.5 -->
<match>
<test name="family"><string>sans-serif</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Sans</string>
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Zen Hei</string>
<!-- Please install WenQuanYi Zen Hei first -->
<string>Liberation Sans</string>
<string>Droid Sans</string>
<string>WenQuanYi Bitmap Song</string>
<!-- Please install WenQuanYi Bitmap Song first -->
<string>AR PL UKai CN</string>
<string>AR PL UKai HK</string>
<string>AR PL UKai TW</string>
<string>AR PL UKai TW MBE</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL UMing TW</string>
<string>AR PL UMing TW MBE</string>
<string>Bitstream Charter</string>
<string>Century Schoolbook L</string>
<string>Courier 10 Pitch</string>
<!-- Please install Courier 10 Pitch first -->
<string>DejaVu Sans</string>
<string>DejaVu Sans Condensed</string>
<string>DejaVu Sans Light</string>
<string>DejaVu Sans Mono</string>
<string>DejaVu Serif</string>
<string>DejaVu Serif Condensed</string>
<string>Dingbats</string>
<string>Droid Sans</string>
<string>Droid Sans Mono</string>
<string>Droid Serif</string>
<string>FreeMono</string>
<string>FreeSans</string>
<string>FreeSerif</string>
<string>Garuda</string>
<string>KacstArt</string>
<string>KacstBook</string>
<string>KacstDecorative</string>
<string>KacstDigital</string>
<string>KacstFarsi</string>
<string>KacstLetter</string>
<string>KacstNaskh</string>
<string>KacstOffice</string>
<string>KacstOne</string>
<string>KacstPen</string>
<string>KacstPoster</string>
<string>KacstQurn</string>
<string>KacstScreen</string>
<string>KacstTitle</string>
<string>KacstTitleL</string>
<string>Kedage</string>
<string>Khmer OS</string>
<string>Khmer OS System</string>
<string>Kinnari</string>
<string>Liberation Mono</string>
<string>Liberation Sans</string>
<string>Liberation Sans Narrow</string>
<string>Liberation Serif</string>
<string>Lohit Bengali</string>
<string>Lohit Gujarati</string>
<string>Lohit Hindi</string>
<string>Lohit Punjabi</string>
<string>Lohit Tamil</string>
<string>Loma</string>
<string>Mallige</string>
<string>Meera</string>
<string>Mukti Narrow</string>
<string>Mukti Narrow Bold</string>
<string>NanumGothic</string>
<string>NanumMyeongjo</string>
<string>Nimbus Mono L</string>
<string>Nimbus Roman No9 L</string>
<string>Nimbus Sans L</string>
<string>Norasi</string>
<string>OpenSymbol</string>
<string>Phetsarath OT</string>
<string>Pothana2000</string>
<string>Purisa</string>
<string>Rachana</string>
<string>Rekha</string>
<string>Saab</string>
<string>Sawasdee</string>
<string>Standard Symbols L</string>
<string>Symbol</string>
<string>TakaoPGothic</string>
<string>Tlwg Typist</string>
<string>Tlwg Typo</string>
<string>TlwgMono</string>
<string>TlwgTypewriter</string>
<string>URW Bookman L</string>
<string>URW Chancery L</string>
<!-- Please install URW Chancery L first -->
<string>URW Gothic L</string>
<string>URW Palladio L</string>
<string>Ubuntu</string>
<string>Ubuntu Condensed</string>
<string>Ubuntu Light</string>
<string>Ubuntu Mono</string>
<string>Umpush</string>
<string>Untitled1</string>
<string>Vemana2000</string>
<string>Waree</string>
<string>gargi</string>
<string>mry_KacstQurn</string>
<string>utkal</string>
<string>文泉驿微米黑</string>
<string>文泉驿正黑</string>
<!-- Please install 文泉驿正黑 first -->
<string>文泉驿点阵正黑</string>
<string>文泉驿等宽微米黑</string>
<string>文泉驿等宽正黑</string>
</edit>
</match>
<match>
<test name="family"><string>serif</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Serif</string>
<string>WenQuanYi Bitmap Song</string>
<!-- Please install WenQuanYi Bitmap Song first -->
<string>AR PL UMing CN</string>
<string>AR PL SungtiL GB</string>
<string>WenQuanYi Zen Hei Sharp</string>
<string>AR PL UMing TW</string>
<string>Liberation Serif</string>
<string>Bitstream Charter</string>
<string>Droid Serif</string>
<string>AR PL UKai CN</string>
<string>AR PL UKai HK</string>
<string>AR PL UKai TW</string>
<string>AR PL UKai TW MBE</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL UMing TW</string>
<string>AR PL UMing TW MBE</string>
<string>Bitstream Charter</string>
<string>Century Schoolbook L</string>
<string>Courier 10 Pitch</string>
<!-- Please install Courier 10 Pitch first -->
<string>DejaVu Sans</string>
<string>DejaVu Sans Condensed</string>
<string>DejaVu Sans Light</string>
<string>DejaVu Sans Mono</string>
<string>DejaVu Serif</string>
<string>DejaVu Serif Condensed</string>
<string>Dingbats</string>
<string>Droid Sans</string>
<string>Droid Sans Mono</string>
<string>Droid Serif</string>
<string>FreeMono</string>
<string>FreeSans</string>
<string>FreeSerif</string>
<string>Garuda</string>
<string>KacstArt</string>
<string>KacstBook</string>
<string>KacstDecorative</string>
<string>KacstDigital</string>
<string>KacstFarsi</string>
<string>KacstLetter</string>
<string>KacstNaskh</string>
<string>KacstOffice</string>
<string>KacstOne</string>
<string>KacstPen</string>
<string>KacstPoster</string>
<string>KacstQurn</string>
<string>KacstScreen</string>
<string>KacstTitle</string>
<string>KacstTitleL</string>
<string>Kedage</string>
<string>Khmer OS</string>
<string>Khmer OS System</string>
<string>Kinnari</string>
<string>Liberation Mono</string>
<string>Liberation Sans</string>
<string>Liberation Sans Narrow</string>
<string>Liberation Serif</string>
<string>Lohit Bengali</string>
<string>Lohit Gujarati</string>
<string>Lohit Hindi</string>
<string>Lohit Punjabi</string>
<string>Lohit Tamil</string>
<string>Loma</string>
<string>Mallige</string>
<string>Meera</string>
<string>Mukti Narrow</string>
<string>Mukti Narrow Bold</string>
<string>NanumGothic</string>
<string>NanumMyeongjo</string>
<string>Nimbus Mono L</string>
<string>Nimbus Roman No9 L</string>
<string>Nimbus Sans L</string>
<string>Norasi</string>
<string>OpenSymbol</string>
<string>Phetsarath OT</string>
<string>Pothana2000</string>
<string>Purisa</string>
<string>Rachana</string>
<string>Rekha</string>
<string>Saab</string>
<string>Sawasdee</string>
<string>Standard Symbols L</string>
<string>Symbol</string>
<string>TakaoPGothic</string>
<string>Tlwg Typist</string>
<string>Tlwg Typo</string>
<string>TlwgMono</string>
<string>TlwgTypewriter</string>
<string>URW Bookman L</string>
<string>URW Chancery L</string>
<!-- Please install URW Chancery L first -->
<string>URW Gothic L</string>
<string>URW Palladio L</string>
<string>Ubuntu</string>
<string>Ubuntu Condensed</string>
<string>Ubuntu Light</string>
<string>Ubuntu Mono</string>
<string>Umpush</string>
<string>Untitled1</string>
<string>Vemana2000</string>
<string>Waree</string>
<string>gargi</string>
<string>mry_KacstQurn</string>
<string>utkal</string>
<string>文泉驿微米黑</string>
<string>文泉驿正黑</string>
<!-- Please install 文泉驿正黑 first -->
<string>文泉驿点阵正黑</string>
<string>文泉驿等宽微米黑</string>
<string>文泉驿等宽正黑</string>
</edit>
</match>
<match>
<test name="family"><string>monospace</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Zen Hei Mono</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans Mono</string>
<string>Droid Sans Mono</string>
<string>WenQuanYi Zen Hei Sharp</string>
<string>Liberation Sans Mono</string>
<!-- Please install Liberation Sans Mono first -->
<string>AR PL UMing TW</string>
<string>AR PL UKai CN</string>
<string>AR PL UKai HK</string>
<string>AR PL UKai TW</string>
<string>AR PL UKai TW MBE</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL UMing TW</string>
<string>AR PL UMing TW MBE</string>
<string>Bitstream Charter</string>
<string>Century Schoolbook L</string>
<string>Courier 10 Pitch</string>
<!-- Please install Courier 10 Pitch first -->
<string>DejaVu Sans</string>
<string>DejaVu Sans Condensed</string>
<string>DejaVu Sans Light</string>
<string>DejaVu Sans Mono</string>
<string>DejaVu Serif</string>
<string>DejaVu Serif Condensed</string>
<string>Dingbats</string>
<string>Droid Sans</string>
<string>Droid Sans Mono</string>
<string>Droid Serif</string>
<string>FreeMono</string>
<string>FreeSans</string>
<string>FreeSerif</string>
<string>Garuda</string>
<string>KacstArt</string>
<string>KacstBook</string>
<string>KacstDecorative</string>
<string>KacstDigital</string>
<string>KacstFarsi</string>
<string>KacstLetter</string>
<string>KacstNaskh</string>
<string>KacstOffice</string>
<string>KacstOne</string>
<string>KacstPen</string>
<string>KacstPoster</string>
<string>KacstQurn</string>
<string>KacstScreen</string>
<string>KacstTitle</string>
<string>KacstTitleL</string>
<string>Kedage</string>
<string>Khmer OS</string>
<string>Khmer OS System</string>
<string>Kinnari</string>
<string>Liberation Mono</string>
<string>Liberation Sans</string>
<string>Liberation Sans Narrow</string>
<string>Liberation Serif</string>
<string>Lohit Bengali</string>
<string>Lohit Gujarati</string>
<string>Lohit Hindi</string>
<string>Lohit Punjabi</string>
<string>Lohit Tamil</string>
<string>Loma</string>
<string>Mallige</string>
<string>Meera</string>
<string>Mukti Narrow</string>
<string>Mukti Narrow Bold</string>
<string>NanumGothic</string>
<string>NanumMyeongjo</string>
<string>Nimbus Mono L</string>
<string>Nimbus Roman No9 L</string>
<string>Nimbus Sans L</string>
<string>Norasi</string>
<string>OpenSymbol</string>
<string>Phetsarath OT</string>
<string>Pothana2000</string>
<string>Purisa</string>
<string>Rachana</string>
<string>Rekha</string>
<string>Saab</string>
<string>Sawasdee</string>
<string>Standard Symbols L</string>
<string>Symbol</string>
<string>TakaoPGothic</string>
<string>Tlwg Typist</string>
<string>Tlwg Typo</string>
<string>TlwgMono</string>
<string>TlwgTypewriter</string>
<string>URW Bookman L</string>
<string>URW Chancery L</string>
<!-- Please install URW Chancery L first -->
<string>URW Gothic L</string>
<string>URW Palladio L</string>
<string>Ubuntu</string>
<string>Ubuntu Condensed</string>
<string>Ubuntu Light</string>
<string>Ubuntu Mono</string>
<string>Umpush</string>
<string>Untitled1</string>
<string>Vemana2000</string>
<string>Waree</string>
<string>gargi</string>
<string>mry_KacstQurn</string>
<string>utkal</string>
<string>文泉驿微米黑</string>
<string>文泉驿正黑</string>
<!-- Please install 文泉驿正黑 first -->
<string>文泉驿点阵正黑</string>
<string>文泉驿等宽微米黑</string>
<string>文泉驿等宽正黑</string>
</edit>
</match>
</fontconfig>
|