服務器安裝字體庫
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/typeface
安裝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
confluence UI 界面導入字體
此字體(黑體 常規)可以在windows c/Windows/Fonts 下搜索到
命令匯總
cd /etc/yum.repos.d/
rm -rf CentOS-Base.repo epel.repo Centos-7.repo epel-7.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install fontconfig
cd /usr/share/fonts/
mkdir typeface
wget xxxx/confluence/fonts.tar.gz
tar -xvf fonts.tar.gz -C typeface
rm -rf fonts.tar.gz
mv typeface/tmp/* typeface/
rm -rf typeface/tmp/
chmod -R 755 /usr/share/fonts/typeface
yum -y install ttmkfdir
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
vim /etc/fonts/fonts.conf
<dir>/usr/share/fonts/typeface</dir>
fc-cache
vim /data/atlassian/confluence/bin/setenv.sh
CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/typeface/ ${CATALINA_OPTS}"
rm -rf /data/atlassian/application-data/confluence/viewfile/*
rm -rf /data/atlassian/application-data/confluence/shared-home/dcl-document/*
/etc/init.d/confluence restart
confluence UI界面安裝黑體