您的位置:首页 > 其它

xelatex引擎调用系统字体

2014-10-04 17:39 399 查看
作者:金良(golden1314521@gmail.com) csdn博客:http://blog.csdn.net/u012176591





由于TEX文件中用到了本地操作系统字库,所以用XeLaTeX编译,发现缺少某些字体

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
!  
! fontspec error: "font-not-found" 
!  
! The font "[KaiTi]" cannot be found. 
!  
! See the fontspec documentation for further information. 
! For immediate help type H <return>. 
!...............................................
怎么解决呢?下面是步骤:

1.首先,下载相应字体,如OpenType 字体文件 (.otf)、 TTF (.TTF)等

2.打开控制面板->字体,将字体文件拖进去,如下图:



这样字体就安装成功了。

再次用XeLaTeX编译,发现不能生成DVI或PDF:

<span style="font-size:18px;">** WARNING ** Obsolete four arguments of "endchar" will be used for Type 1 "seac" operator.
** ERROR ** This font using the "seac" command for accented characters...

Output file removed.
 )
(see the transcript file for additional information)
Error 1 (driver return code) generating output;</span>


Google上查了好久,貌似这是xelatex引擎的一个bug,无奈,我删除了所有指定本地操作系统的字体的语句,例如

{\fontspec{Inconsolata} Inconsolata}


再次编译,发现正常了。

后来发现不是这儿的问题,问题之处在这儿

\begin{itemize}
\item[] {\small \fontspec{Latin Modern Mono} printf("Hello \%s\<span style="font-family: Arial, Helvetica, sans-serif;">\textbackslash </span> n", name);} [cmtt]
\item[] {\small \fontspec[Mapping=tex-text-tt]{Inconsolata} printf("Hello \%s\textbackslash  n", name);} [Inconsolata]
\end{itemize}
第二行的“;”挪到字体外边(不知道为什么第一条就不用挪位置),就可以了。不明白为什么会出现那样的错误。修改后如下:

\begindot
\item[] {\small \fontspec{Latin Modern Mono} printf("Hello \%s\textbackslash n", name);}[cmtt]
\item[] {\small \fontspec[Mapping=tex-text-tt]{Inconsolata} printf("Hello \%s\textbackslash n", name)};[Inconsolata]
\myenddot
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: