1、linux查看系统字体命令:fc-list
root@c6e06f09edff:/usr/local/tomcat# fc-list
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book
/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
图中所示没有中文字体
如果遇到commond not fond需要安装fontconfig
ubuntu安装命令:apt-get install fontconfig
centos安装命令:yum install fontconfig
2、安装字体
linux默认没有中文字体,可以将win10系统中字体文件拷过去使用
win10字体文件夹:C:\windows\Fonts
linux字体文件夹:
/usr/share/fonts/
1.在linux字体文件夹/usr/share/fonts/中新建一个名叫win_ch_fonts的文件夹,将字体文件放进去
2.刷新字体缓存:
fc-cache
3.再次查看字体:
[root@iZ251fpy8x9Z sfeuser01]# fc-list
/usr/share/fonts/win_ch_fonts/STXINWEI.TTF: STXinwei:style=Regular
/usr/share/fonts/win_ch_fonts/STXIHEI.TTF: STXihei:style=Regular
/usr/share/fonts/win_ch_fonts/msyh.ttc: Microsoft YaHei:style=Normal
/usr/share/fonts/win_ch_fonts/FZLTCXHJW.TTF: FZLanTingHeiS\-UL\-GB:style=Regular
/usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
/usr/share/fonts/win_ch_fonts/msyhl.ttc: Microsoft YaHei UI,Microsoft YaHei UI Light:style=Light,Regular
/usr/share/fonts/win_ch_fonts/STFANGSO.TTF: STFangsong:style=Regular
/usr/share/fonts/win_ch_fonts/STKAITI.TTF: STKaiti:style=Regular
/usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
/usr/share/fonts/win_ch_fonts/SIMLI.TTF: LiSu:style=Regular
/usr/share/fonts/win_ch_fonts/STHUPO.TTF: STHupo:style=Regular
/usr/share/fonts/win_ch_fonts/SIMYOU.TTF: YouYuan:style=Regular
成功