confluence 附件docx文件 乱码处理

服务器安装字体库

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界面安装黑体
原文地址:https://www.cnblogs.com/huandada/p/11365375.html