[Tex/LaTex] Xetex – Font not found!

fontspreamblexetex

I'm a TeX Newbie and I'm trying to get XeTex to work with FontAwesome. Initially I got the error : The font "FontAwesome" cannot be found. So I added the path defaultfontfeatures as suggested in: FontAwesome font not found?

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

Now I want to choose some other fonts like these:

       \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}

I get the following error:

       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.

What can I do to fix this?

EDIT:

The error regarding 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}

                ? 

Best Answer

If you've installed the font in a proper texmf directory, run texhash or the equivalent for your system. XeTeX will then find the font without having to specify the location.

Secondly, including Path in \defaultfontfeatures is almost certainly wrong in almost all cases. This is what is causing your error — after specifying a Path, fontspec assumes that the font to be loaded is specified by filename. So when you write

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

this is equivalent to

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

which in turn means that "Minion Pro" will be attempted to be loaded by filename from the fontawesome directory. This obviously fails!


Short answer: just delete the line including \defaultfontfeatures and you should be right, as long as fontawesome is installed correctly.

(By the way, \setromanfont has now been deprecated for many many years; you should use \setmainfont instead.)