# How to know the correct name for an installed font to be passed as the argument of \setmainfont?

I have just installed a font called "28 Days Later" from www.1001freefonts.com but now I have a problem because the following code snippet does not compile, it produces some errors, roughly saying that "The 28 Days Later font could not be found.".

\documentclass[preview,border=12pt,12pt,varwidth]{standalone}

\usepackage{fontspec}
\setmainfont{28 Days Later}

\begin{document}
Oh my ghost
\end{document}


So, how do we know the correct name for an installed font to be passed as the argument of \setmainfont?

• Something might be wrong with that particular font. – Werner Feb 15 '15 at 7:58
• @Werner: It is something wrong, as the compilation fails with 28 Days Later.ttf, but not with some other arbitrary one – user31729 Feb 15 '15 at 8:05
• Compiling with LuaLaTeX works? – karlkoeller Feb 15 '15 at 11:18
• @karlkoeller: Nope, lualatex fails too – user31729 Feb 15 '15 at 12:43
• @ChristianHupfer LuaLaTeX recognises it in my case. – karlkoeller Feb 15 '15 at 12:45

This is (unfortunately) not working with the 28 Days Later font, since the xelatex compilation breaks with some error 11.

The principal way is to use \setmainfont{fontname}[options]

The manual of fontspec states, that following font options must be set if the font is specified by filename (and not fontname)

• BoldFont
• ItalicFont
• BoldItalicFont

Since 28 Days Later.ttf fails, I used winnie.ttf from the same website, for demonstration only and principal pathway, but it's not the solution to the question, of course.

\documentclass[preview,border=12pt,12pt,varwidth]{standalone}

\usepackage{fontspec}

\setmainfont{winnie}[
Extension=.ttf,
UprightFont=winnie,
BoldFont=winnie,
ItalicFont=winnie,
BoldItalicFont=winnie,
SmallCapsFont=winnie]

\begin{document}
Oh my ghost
\end{document}