[Tex/LaTex] Using specific fonts in XeTeX

fontsfontspecxetex

I'm trying to use specific fonts in my LaTeX file. But fontspec can't find my desired fonts. I use

family file | grep -i helvetica

to know the names to use in XeTeX using fontspec

/usr/local/share/fonts/HelveticaNeueLTPro-UltLtIt.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 25 UltLt
/usr/local/share/fonts/HelveticaNeueLTPro-BdCn.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 57 Cn
/usr/local/share/fonts/HelveticaNeueLTPro-Lt.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 45 Lt

My .cls part that needs specific fonts is

\RequirePackage[quiet]{fontspec}
\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}

\setmathfont{Latin Modern Math}

\newfontfamily\bodyfont[]{HelveticaNeueLT Pro 45 Lt}
\newfontfamily\thinfont[]{HelveticaNeueLT Pro 25 UltLt}
\newfontfamily\headingfont[]{HelveticaNeueLT Pro 57 Cn}

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeueLT Pro 45 Lt}

But fontspec gives errors all the time!

Best Answer

You need to use the PostScript name, usually it's the same as the filename sans extension, but not always --- use a font information utility to determine what it is:

\documentclass{minimal}
\RequirePackage[quiet]{fontspec}
\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
\begin{document}
\newfontfamily\bodyfont[]{HelveticaNeueLTStd-Lt}
\newfontfamily\thinfont[]{HelveticaNeueLTStd-UltLt}
\newfontfamily\headingfont[]{HelveticaNeueLTStd-Cn}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeueLTStd-Lt}
Main. \bodyfont (bodyfont is same as main)\par
\thinfont Thin.\par
\headingfont Headingfont is condensed.
\end{document}