CentOS7安裝字體庫


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刷新

     運行sudo fc-cache -f -v命令刷新字體緩存

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM