Fontconfig是一个用于配置和自定义字体访问的库
yum -y install fontconfig
拷贝需要的字体文件 fonts.zip(或自己电脑中的字体文件c:/Windows/Fonts/* 注:不要拷贝其中的链接文件)到/usr/share/fonts/typeface下
cd /usr/share/fonts/
mkdir typeface
unzip fonts.zip -d /usr/share/fonts/typeface
mv /usr/share/fonts/typeface/fonts/* /usr/share/fonts/typeface
chmod -R 755 /usr/share/fonts
安装ttmkfdir来搜索目录中所有的字体信息,并汇总生成fonts.scale文件
yum -y install ttmkfdir
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
将字体的路径加到配置里
vim /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>/usr/share/fonts/typeface</dir> <!-- 新加此行 -->
<dir prefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>
<!--
Accept deprecated 'mono' alias, replacing it with 'monospace'
-->
刷新字体缓存
fc-cache
在confluence的安装目录, 如/data/atlassian/confluence/bin下找到setenv.sh, 找到CATALINA_OPTS, 加入一行
CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/typeface/ ${CATALINA_OPTS}"
清空confluence的home下viewfile目录和shared-home/dcl-document目录里的所有缓存文档文件, 不清空的话, confluence预览旧文件时还是会显示方框,只有新文件才会正常.
rm -rf /data/atlassian/application-data/confluence/viewfile/*
rm -rf /data/atlassian/application-data/confluence/shared-home/dcl-document/*
重启confluence
/etc/init.d/confluence restart
原文:https://www.cnblogs.com/huandada/p/11365375.html