linux安装中文字体

在此我们以仿宋字体为例

1.C:\Windows\Fonts   这个目录下的simfang.ttf(仿宋字体)文件上传到root

yum install -y fontconfig mkfontscale

#在centos上和ubuntu上安装字体方法都是一样的,我们只需要进行相关的操作即可。

#把simfang.ttf复制到/usr/share/fonts/目录下,使用如下命令:

cd /root/

cp simfang.ttf /usr/share/fonts/
#然后建立字体索引信息,更新字体缓存,使用如下命令:

cd /usr/share/fonts/

mkfontscale

mkfontdir

fc-cache
#至此,字体已经安装完毕。

#现在我们再来查看微软雅黑字体,是否安装成功,使用如下命令:

fc-list :lang=zh

 

   Font font = new Font("FangSong", 20);

参考:https://www.cnblogs.com/huangyanqi/p/10609587.html

posted @ 2021-08-18 17:01  MAUI程序员  阅读(959)  评论(0)    收藏  举报