Xetex - 未找到字体!

Xetex - 未找到字体!

我是 TeX 新手,我正在尝试让 XeTex 与 FontAwesome 配合使用。最初我收到错误:无法找到字体“FontAwesome”。因此我按照以下建议添加了路径 defaultfontfeatures:未找到 FontAwesome 字体?

      \usepackage{fontspec}
      \defaultfontfeatures{
       Path = /usr/local/texlive/2013/texmfdist/fonts/opentype/public/fontawesome/ } 
      \usepackage{fontawesome,url}

现在我想选择一些其他字体,例如:

       \setromanfont[Mapping={tex-text}, 
          Numbers={OldStyle},
          Ligatures={Common}]{Minion Pro}
       \setsansfont[Mapping=tex-text,
          Ligatures={Common}, 
          Colour=AA0000]{Unit-Medium}
       \setmonofont[Mapping=tex-text,Scale=0.72]{Consolas} 

       \newfontface\scheader[SmallCapsFont={Minion Pro},SmallCapsFeatures={Letters=SmallCaps}]{Minion Pro}

       \newfontface\addressblock[Mapping={tex-text}, 
             Numbers={OldStyle},
             Ligatures={Common}]{Minion Pro Medium Caption}

我收到以下错误:

       kpathsea:make_tex: Invalid fontname `[/usr/local/texlive/2013/texmf-dist/fonts/opentype/public/fontawesome/Minion Pro]/ICU', contains '['

       The font "Minion Pro" cannot be found.

我该如何修复此问题?

编辑:

关于 fontawesome 的错误:

                )) (/usr/local/texlive/2013/texmf-dist/tex/latex/fontawesome/fontawesome.sty
                kpathsea: Running mktextfm FontAwesome
                /usr/local/texlive/2013/texmf-dist/web2c/mktexnam: Could not map source abbreviation F for FontAwesome.
                /usr/local/texlive/2013/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2013/texmf-dist/fonts/map/fontname/special.map?
                mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input FontAwesome
                This is METAFONT, Version 2.718281 (TeX Live 2013)


                kpathsea: Running mktexmf FontAwesome
                ! I can't find file `FontAwesome'.
                <*> ...our; mag:=1; nonstopmode; input FontAwesome

                Please type another input file name
                ! Emergency stop.
                <*> ...our; mag:=1; nonstopmode; input FontAwesome

                Transcript written on mfput.log.
                grep: FontAwesome.log: No such file or directory
                mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input FontAwesome' failed to make FontAwesome.tfm.
                kpathsea: Appending font creation commands to missfont.log.


                !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                !
                ! fontspec error: "font-not-found"
                ! 
                ! The font "FontAwesome" cannot be found.
                ! 
                ! See the fontspec documentation for further information.
                ! 
                ! For immediate help type H <return>.
                !...............................................  

                l.27 \newfontfamily{\FA}{FontAwesome}

                ? 

答案1

如果您已将字体安装在正确的 texmf 目录中,请运行texhash或系统等效程序。XeTeX 随后将找到字体,而无需指定位置。

其次,在几乎所有情况下,包含Pathin\defaultfontfeatures几乎肯定是错误的。这就是导致错误的原因——在指定 a 之后Path,fontspec 假定要加载的字体由 filename 指定。因此,当您编写

\setromanfont[Mapping={tex-text}, 
          Numbers={OldStyle},
          Ligatures={Common}]{Minion Pro}

这相当于

\setromanfont[
          Path = /usr/local/texlive/2013/texmfdist/fonts/opentype/public/fontawesome/ ,
          Mapping={tex-text}, 
          Numbers={OldStyle},
          Ligatures={Common}]{Minion Pro}

这反过来意味着将尝试通过目录中的文件名加载“Minion Pro” fontawesome。这显然会失败!


\defaultfontfeatures简短的回答:只要fontawesome安装正确,只需删除包含的行,你就应该是对的。

(顺便说一句,\setromanfont现在已经弃用很多年了;你应该使用\setmainfont它。)

相关内容