#服務器安裝字體庫 Fontconfig是一個用於配置和自定義字體訪問的庫vim
yum -y install fontconfig
拷貝須要的字體文件 fonts.zip(或本身電腦中的字體文件c:/Windows/Fonts/* 注:不要拷貝其中的連接文件)到/usr/share/fonts/typeface下 字體包內容: windows
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' -->
刷新字體緩存app
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預覽舊文件時仍是會顯示方框,只有新文件纔會正常.spa
rm -rf /data/atlassian/application-data/confluence/viewfile/* rm -rf /data/atlassian/application-data/confluence/shared-home/dcl-document/*
重啓confluencerest
/etc/init.d/confluence restart
#confluence UI 界面導入字體 此字體(黑體 常規)能夠在windows c/Windows/Fonts 下搜索到 code
#命令彙總 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/blog
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界面安裝黑體