[Tex/LaTex] fontspec error: “font-not-found”

fontspecxetex

I installed some .otf fonts in /usr/local/texlive/texmf-local/fonts, changed
/usr/local/texlive/2015/texmf-var/fonts/conf/texlive-fontconfig.conf
adding the string

<dir>/usr/local/texlive/texmf-local/fonts</dir>

I copied this changed file in /etc/fonts/conf.d/09-texlive.conf.
Finally, i gave:

fc-cache -fsv

It seems the new font are found into the system:

/usr/local/texlive/texmf-local/fonts/opentype/ArnoPro: caching, new cache contents: 32 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/BriosoPro: caching, new cache contents: 42 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/CaslonPro: caching, new cache contents: 6 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/ChaparralPro: caching, new cache contents: 32 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/Crimson: caching, new cache contents: 6 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/Fontin: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/GaramondPremierePro: caching, new cache contents: 34 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/JensonPro: caching, new cache contents: 32 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/MinionPro: caching, new cache contents: 64 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/MyriadPro: caching, new cache contents: 40 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/opentype/WarnockPro: caching, new cache contents: 32 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/source: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/texlive/texmf-local/fonts/source/local: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/tfm: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/texlive/texmf-local/fonts/tfm/local: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/texlive/texmf-local/fonts/type1/local: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/texlive/texmf-local/fonts/vf: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/texlive/texmf-local/fonts/vf/local: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts: caching, new cache contents: 0 fonts, 5 dirs
/usr/X11R6/lib/X11/fonts: skipping, no such directory
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/.local/share/fonts: skipping, no such directory
/usr/local/texlive/2015/texmf-dist/fonts/opentype: caching, new cache contents: 0 fonts, 7 dirs
/usr/local/texlive/2015/texmf-dist/fonts/truetype: caching, new cache contents: 0 fonts, 10 dirs
/usr/local/texlive/2015/texmf-dist/fonts/type1: caching, new cache contents: 0 fonts, 26 dirs
/usr/local/texlive/texmf-local/fonts: caching, new cache contents: 0 fonts, 5 dirs
/var/cache/fontconfig: cleaning cache directory
/.cache/fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded

Moreover, for instance:

samiel@debian:~$ fc-list : family file | grep -i fontin
/usr/local/texlive/texmf-local/fonts/opentype/Fontin/Fontin-SmallCaps.otf: Fontin SmallCaps,Fontin
/usr/local/texlive/texmf-local/fonts/opentype/Fontin/Fontin-Bold.otf: Fontin
/usr/local/texlive/texmf-local/fonts/opentype/Fontin/Fontin-Italic.otf: Fontin
/usr/local/texlive/texmf-local/fonts/opentype/Fontin/Fontin-Regular.otf: Fontin

But if I try to compile with xelatex using one of the fonts just added, I obtain:

(/usr/local/texlive/2015/texmf-dist/tex/latex/unicode-math/unicode-math-table.t
ex)))kpathsea:make_tex: Invalid fontname `Garamond Premier Pro', contains ' '


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

l.6 ...TeX,Numbers=OldStyle]{Garamond Premier Pro}

? 

What am I missing? Thanx

PS

Please consider:

    root@debian:/usr/local/texlive/texmf-local/fonts/opentype/CaslonPro# otfinfo -a ACaslonPro-Regular.otf 
Adobe Caslon Pro

A MWE

    \documentclass[a4paper]{article}
\usepackage{fontspec}

\defaultfontfeatures{Contextuals=NoAlternate}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{Adobe Caslon Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

\begin{document}
Quel ramo del lago di Como
\end{document}

The output

    (/usr/local/texlive/2015/texmf-dist/tex/latex/fontspec/fontspec.cfg)))kpathsea:make_tex: Invalid fontname `Adobe Caslon Pro', contains ' '


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

l.5 ...res=TeX,Numbers=OldStyle]{Adobe Caslon Pro}

? 

I'm very confused

FURTHER PS

In a partition where I have a Debian installed all works fine. The .otf are property of root-staff and permission are -rw——. The same in the other, not working partition…

Best Answer

The algorithms to find fonts in XeLaTeX and LuaLaTeX are different. I don’t fully understand them, to be honest, but I’ve found that what works on both is the human-readable name reported by fc-list. So, let’s take as an example the Linux Libertine family. (In practical real-world use, there’s the libertine package for this, but I picked this example because the right name to use is distinctive.)

$ fc-list | grep "Linux Libertine" | grep ".otf" | grep 2015
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_MO.otf: Linux Libertine Mono O:style=Mono Oblique
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_RZI.otf: Linux Libertine O:style=Semibold Italic
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_RB.otf: Linux Libertine O:style=Bold
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_M.otf: Linux Libertine Mono O:style=Mono
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_DR.otf: Linux Libertine Display O:style=Regular
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_RZ.otf: Linux Libertine O:style=Semibold
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_RBI.otf: Linux Libertine O:style=Bold Italic
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_RI.otf: Linux Libertine O:style=Italic
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_MBO.otf: Linux Libertine Mono O :style=Mono Bold Oblique
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_MB.otf: Linux Libertine Mono O :style=Mono Bold
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_R.otf: Linux Libertine O:style=Regular
/usr/local/texlive/2015/texmf-dist/fonts/opentype/public/libertine/LinLibertine_I.otf: Linux Libertine Initials O:style=Initials

The names we want to use are the ones in the middle field, with the style appended if necessary. So the file

\documentclass[10pt]{standalone}
\usepackage{fontspec}

\setmainfont{Linux Libertine O}
\setmonofont[ItalicFont={Linux Libertine Mono O Oblique}]{Linux Libertine Mono O}
\newfontface{\lli}{Linux Libertine Display O}

\begin{document}
Linux Libertine Regular \textbf{Bold} \textit{Italic} \textsc{\textit{Italic Small Caps}}

\texttt{Mono} \texttt{\textsl{Mono Oblique}} {\lli Display}
\end{document}

produces:

enter image description here

In this case, we needed to give a hint which font to use for mono italic, but fontspec is smart enough to make everything else work out of the box. Another problem reported in the comments to my previous answer was with \scshape\itshape. If your font family has a separate italic small caps font, the instructions to load that are in §5.1.2 of the fontspec manual.