2

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?

  • 1
    Something might be wrong with that particular font. – Werner Feb 15 '15 at 07:58
  • @Werner: It is something wrong, as the compilation fails with 28 Days Later.ttf, but not with some other arbitrary one –  Feb 15 '15 at 08:05
  • Compiling with LuaLaTeX works? – karlkoeller Feb 15 '15 at 11:18
  • @karlkoeller: Nope, lualatex fails too –  Feb 15 '15 at 12:43
  • @ChristianHupfer LuaLaTeX recognises it in my case. – karlkoeller Feb 15 '15 at 12:45
  • @karlkoeller: Really? Well, I tested it in an early stage, perhaps there was another error –  Feb 15 '15 at 12:45
  • Yangchen Lin’s answer of 15 Sept 2014, at https://tex.stackexchange.com/a/203153/7883, although it’s an answer to a somewhat problem, works here too. Just open the font in FontForge and select “Generate Fonts” under the “File” menu. You don’t even have to fix the em-size as FontForge will suggest, though you may wish to. – Thérèse Feb 15 '15 at 18:26

1 Answers1

2

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}

enter image description here