歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> BSD >> FreeBSD安裝各種字體

FreeBSD安裝各種字體

日期:2017/2/28 14:36:36   编辑:BSD

X11 使用的默認字體不是很理想。 大型的字體顯得參差不齊,打開浏覽器一看中文就能吐血而亡。

因此,需要我們手工加入字體,可采用如下兩種方式:

1、添加Times Roman,Helvetica,Palatino等Type1字體

URW字體集合 (x11-fonts/urwfonts) 就包括了高質量的 標准 type1 字體。因此安裝URW即可:

1.1安裝URW

# cd /usr/ports/x11-fonts/urwfonts
# make install clean

1.2 配置URW

需要在 X 服務器的配置文件 (/etc/X11/xorg.conf) 中增加下面的配置:

FontPath "/usr/local/lib/X11/fonts/URW/"

也可采用命令方式在當前會話中執行,以下內容需要在X桌面的Terminal執行才可以。

% xset fp+ /usr/local/lib/X11/fonts/URW
% xset fp rehash

2、安裝微軟雅黑、宋體等等中文字體即 TrueType® 字體

Xorg 已經內建了對 TrueType® 字體的支持

2.1 配置文件

將下面這行添加到 /etc/X11/xorg.conf 文件的 "Module" 部分

Load "freetype"

2.2為 TrueType® 字體創建一個目錄

比如, /usr/local/lib/X11/fonts/TrueType, 然後把所有的 TrueType® 字體復制到這個目錄。記住您不能直接從 Macintosh® 計算機中提取TrueType® 字體; 能被 X11 使用的必須是UNIX®/MS-DOS®/Windows® 格式的。

2.3 用 ttmkfdir 來創建 fonts.dir 文件, 以便讓X字體引擎知道您已經安裝了這些新文件。

2.3.1 ttmkfdir 需要安裝,直接用pkg_add -r ttmkfdir就能裝上。

2.3.2

# cd /usr/local/lib/X11/fonts/TrueType
# ttmkfdir -o fonts.dir

3.4 把 TrueType® 字體目錄添加到字體路徑中

需要在 X 服務器的配置文件 (/etc/X11/xorg.conf) 中增加下面的配置:

FontPath "/usr/local/lib/X11/fonts/TrueType"

如果要立即啟用請輸入:(以下命令需要在X桌面的Terminal中執行才可以)

% xset fp+ /usr/local/lib/X11/fonts/TrueType
% xset fp rehash

就是這樣。現在 Netscape®,Gimp,StarOffice™ 和其他所有的 X 應用程序 應該可以認出安裝的TrueType® 字體。一些很小的字體(如在 Web 頁面上高分辨率顯示的文本) 和一些很大的字體(在StarOffice™ 下) 現在看起來已經很好了。

3、安裝文泉驿中文字體:
# whereis wqy
wqy: /usr/ports/x11-fonts/wqy
# cd /usr/ports/x11-fonts/wqy
# make install clean
15分鐘左右ok

讓X系統啟動時載入字體。
編輯/etc/X11/xorg.conf
在Section "Files"裡面加一行,FontPath "/usr/local/lib/X11/fonts/wqy"像下面這樣
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/lib/X11/fonts/misc/"
FontPath "/usr/local/lib/X11/fonts/TTF/"
FontPath "/usr/local/lib/X11/fonts/OTF"
FontPath "/usr/local/lib/X11/fonts/Type1/"
FontPath "/usr/local/lib/X11/fonts/100dpi/"
FontPath "/usr/local/lib/X11/fonts/75dpi/"
FontPath "/usr/local/lib/X11/fonts/wqy"
EndSection

Copyright © Linux教程網 All Rights Reserved