版本:texlive2011 ubuntu11.04
以root身份执行:
#cp -r /media/Windows/Fonts/* /usr/share/fonts
#fc-cache
#fc-list
#exit
$less test.tex
$xelatex test.tex
出现如下错误:
kpathsea: Running mktexmf SimSun
! I can't find file `SimSun'.
<*> ...:=ljfour; mag:=1;nonstopmode; input SimSun
Please type another input file name
! Emergency stop.
<*> ...:=ljfour; mag:=1;nonstopmode; input SimSun
Transcript written on mfput.log.
grep: SimSun.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1;nonstopmode; input SimSun' failed to make SimSun.tfm.
kpathsea: Appending font creation commands tomissfont.log.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "SimSun" cannot be found.
!
! See the fontspec documentation for furtherinformation.
!
! For immediate help type H<return>.
!...............................................
l.3 \setmainfont{SimSun}
?
出现错误的原因是:用root拷过来的字体文件的权限是600,使得xelatex无法正常访问字体,出现字体找不到错误。
执行:
sudo chmod 755 /usr/share/fonts/*#此处要注意,文件夹一定要赋予x权限,否则你的系统就会全是框框了。
接下来写一个文件测试下:
vim test.tex
写入如下内容:
- \usepackage{CJKutf8}
- \begin{document}
- \begin{CJK}{UTF8}{gkai}
- 我是楷体
- \end{CJK}
- \begin{CJK}{UTF8}{gbsn}
- 我是宋体
- \end{CJK}
- \end{document}
用xelatex编译下:
xelatex test.tex