将windows的字体复制到/usr/share/fonts目录下,如/usr/share/fonts/winfonts然后执行命令
sudo mkfontscale (创建雅黑字体的fonts.scale文件,它用来控制字体旋转缩放)sudo mkfontdir (创建雅黑字体的fonts.dir文件,它用来控制字体粗斜体产生)sudo fc-cache -fv (建立字体缓存信息,也就是让系统认识认识雅黑)
以下是我安装openoffice的shell,解决了乱码问题
#!/bin/sh#openoffice安装脚本curdir=`pwd`echo "start install openoffice..."#卸载libreofficesudo apt-get remove libreofficeecho "install libdebs.................."#安装依赖库cd $curdircd libdebsdpkg -i x11-common_1%3a7.7+13ubuntu3_all.deb libice6_2%3a1.0.9-1_i386.deb libsm6_2%3a1.2.2-1_i386.deb libxt6_1%3a1.1.5-0ubuntu1_i386.debecho "finish libdebs.....exit ....."#安装linux字体管理软件cd $curdirecho "install linux font soft"cd fontconfigdpkg -i *.debcd $curdir#安装openofficecd DEBS/sudo dpkg -i *.deb#cd $curdir#安装菜单项#cd DEBS/desktop-integration/#sudo dpkg -i openoffice4.1-debian-menus_4.1.3-9783_all.debcd $curdir#复制字体#tar -zxvf fonts.tar.gzecho "copy fonts..............................."cp -rf winfonts /usr/share/fontscd /usr/share/fonts/winfontssudo mkfontscalesudo mkfontdirsudo fc-cache -fvecho "install jdk for openoffice..............."cd $curdircp -rf jdk /opt/openoffice4newPath="$PATH:/opt/openoffice4/jdk/bin"str='PATH="'${newPath}'"'echo $str >/etc/environment#sudo source /etc/environmentPATH=$PATH:/opt/openoffice4/jdk/bin#启动echo "openoffice run............................."/opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &ps -A|grep sofficeecho "openoffice run success..."