1. 程式人生 > >LINUX CentOS7安裝字型庫

LINUX CentOS7安裝字型庫

LINUX CentOS7安裝字型庫

2017年12月26日 17:06:07  閱讀數:4866 個人分類: linux  

 

JAVA畫圖時常用到Font 類物件

這樣的物件依賴於本地的欄位。新裝的linux沒有安裝欄位庫,和相應的字型。

 

1、fc -list檢視字型庫

發現沒有安裝

2、yum -y install fontconfig安裝

3、安裝好後/usr/share目錄下多兩個目錄fonts和fontconfig

4、首先在/usr/shared/fonts目錄下新建一個目錄chinese

 

5、到C:\Windows\Fonts目錄下上傳你需要的字型到/usr/shared/fonts/chinese目錄下

6、修改chinese許可權

chmod -R 755 /usr/share/fonts/chinese

7、接下來需要安裝ttmkfdir來搜尋目錄中所有的字型資訊,並彙總生成fonts.scale檔案,輸入命令:

yum -y install ttmkfdir

8、最後一步就是修改字型配置檔案了,首先通過編輯器開啟配置檔案:

vi /etc/fonts/fonts.conf

 

<!-- Font directory list -->


        <dir>/usr/share/fonts</dir>
        <dir>/usr/share/X11/fonts/Type1</dir> <dir>/usr/share/X11/fonts/TTF</dir> <dir>/usr/local/share/fonts</dir>
        <dir prefix="xdg">fonts</dir>
        <dir>/usr/share/fonts/chinese<dir>
        <!-- the following element will be removed in the future -->
        <dir>~/.fonts</dir>

9、fc-cache重新整理

10、fc-list可以看到剛剛的配置了