您的位置:首页 > 其它

xelatex使用从windows拷过来的系统字体

2013-10-12 17:23 288 查看
版本:texlive2011 ubuntu11.04
以root身份执行:
#cp -r /media/Windows/Fonts/* /usr/share/fonts
#fc-cache
#fc-list
#exit
$less test.tex

1 \documentclass{article}
2 \usepackage{fontspec}
3 \setmainfont{SimSun}
4
5 \begin{document}
6 好啊!hello world
7 \end{document}

$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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: