FreeBSD 基礎系統不預裝桌面字體,需手動安裝 Type1、TrueType 或開源中文字體,並配置 Xorg 識別字體路徑。本文涵蓋 URW Type1、微軟雅黑/宋體等 TTF、文泉驛點陣/向量字體的完整安裝與配置流程。

# cd /usr/ports/x11-fonts/urwfonts
# make install clean
配置 Xorg(/etc/X11/xorg.conf):
Section "Files"
FontPath "/usr/local/lib/X11/fonts/URW/"
EndSection
或當前會話即時生效:
% xset fp+ /usr/local/lib/X11/fonts/URW
% xset fp rehash
/etc/X11/xorg.conf):
Section "Module"
Load "freetype"
EndSection
# mkdir -p /usr/local/lib/X11/fonts/TrueType
# cp *.ttf /usr/local/lib/X11/fonts/TrueType/
ttmkfdir 產生 fonts.dir:
# pkg install ttmkfdir
# cd /usr/local/lib/X11/fonts/TrueType
# ttmkfdir -o fonts.dir
# 在 xorg.conf Files 區段加入
FontPath "/usr/local/lib/X11/fonts/TrueType"
# 即時生效
% xset fp+ /usr/local/lib/X11/fonts/TrueType
% xset fp rehash
# cd /usr/ports/x11-fonts/wqy
# make install clean
# 在 xorg.conf Files 區段加入
FontPath "/usr/local/lib/X11/fonts/wqy"
約 15 分鐘編譯完成,涵蓋文泉驛正黑、微米黑等高品質中文字體。
% fc-list :lang=zh-tw # 列出支援繁體中文的字體
% xlsfonts | grep -i wqy
FreeBSD 現代桌面環境(KDE、GNOME、Xfce)主要透過 Fontconfig 管理字體,建議將字體安裝至 /usr/local/share/fonts/,並執行 fc-cache -fv,無需手動編輯 xorg.conf。傳統 X 核心字體路徑機制漸趨淘汰,但對舊版 X 應用仍需相容。
~/.config/fontconfig/fonts.conf 啟用次像素渲染。Symbol、Wingdings 字體已安裝(可從 URW 或 Windows 複製)。chmod 755、chmod 644 *.ttf)。依循上述步驟,FreeBSD 即可擁有完整的中英文字體支援,滿足瀏覽器、辦公軟體、圖形編輯等需求。