1

I am trying to house all my customizations and fonts in an asset folder so I can use it on multiple documents and maintain the same styles. Unfortunately whenever I try and put the fonts into a path two levels deep I can't compile the document. I get the error:

! error:  (type 2): cannot find file ''
!  ==> Fatal error occurred, no output PDF file produced!

Below works:

\newcommand{\fontmercury}{\setmainfont[Path = ./fonts/,
  BoldFont=mercurybd.ttf,
  ItalicFont=mercuryi.ttf,
  BoldItalicFont=mercurybi.ttf
  ]{mercury.ttf}
}

This does not work:

\newcommand{\fontmercury}{\setmainfont[Path = ./assets/fonts/,
  BoldFont=mercurybd.ttf,
  ItalicFont=mercuryi.ttf,
  BoldItalicFont=mercurybi.ttf
  ]{mercury.ttf}
}

The path is correct, it just generates an error anytime I go more than one level deep.

EDIT: I figured it out. It was the cache problem discussed here. Deleting the otl folder in my case allowed it to compile. LuaTeX cannot find existing font

0

I figure I would post this as an answer since I am not sure how to mark this as answered. But I figured it out shortly after posting. I use TeXLive + TeXWorks. So I deleted the otl folder in the path C:\texlive\2017\texmf-var\luatex-cache\generic\fonts\otl. It worked when it came to building the doc after.

More details: LuaTeX cannot find existing font

0

In addition to deleting the out-of-date otl directory, you should also consider using a different setup for \fontmercury. The fontspec package provides the \newfontfamily directive. For the case at hand, using \newfontfamily would seem more efficient than issuing a \setmainfont directive. You could insert the following instructions in the preamble:

\newfontfamily{\mercury}{mercury.ttf}%
      [Path           = ./fonts/,
       BoldFont       = mercurybd.ttf,
       ItalicFont     = mercuryi.ttf,
       BoldItalicFont = mercurybi.ttf]
\newcommand{\fontmercury}[1]{{\mercury #1}}

Then, in the body of the document, you'd write

\fontmercury{...}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.