admin管理员组

文章数量:1594755

文章目录

  • 前言
  • 一、安装相关包
  • 二、配置相关信息
    • 1.导入字体包
    • 2.修改配置文件
    • 3. 刷新配置并查看字体库


前言

由于JAVA画图时常用到Font 类对象,而这样的对象依赖于本地的字段。
新装的linux没有安装字段库,和相应的字体。
所以需要进行安装


一、安装相关包

[root@mankel ~] yum -y install fontconfig
[root@mankel ~] yum -y install ttmkfdir

二、配置相关信息

1.导入字体包

中文字体包下载地址

将字体包上传到/root目录下
[root@mankel ~] cd /usr/share/fonts
[root@mankel ~] mkdir chinese 
[root@mankel ~] cd chinese
[root@mankel ~] cp /root/chinese.zip ./
[root@mankel ~] unzip chinese.zip
[root@mankel ~] chmod -R 755 /usr/share/fonts/chinese 

2.修改配置文件

[root@mankel ~] vi /etc/fonts/fonts.conf
#以下是需增添内容(供复制)
<dir>/usr/share/fonts/chinese</dir>

新增一行 (红框中内容):

3. 刷新配置并查看字体库

#刷新
[root@mankel ~] fc-cache
#查看
[root@mankel ~] fc-list

本文标签: 中文字体字体库Linux