2

I'm trying to use LuaTeX with Adobe's Garamond Premier Pro, but it doesn't work, saying that:

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

while XeTeX compiles fine.

I managed to narrow down the issue to the following code:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Garamond Premier Pro}
\begin{document}
hello
\end{document}

I'm using TeXLive 2018.

Following Ulrike's suggestion, I changed the font name by the file name:

\documentclass{article}
\usepackage{fontspec}
% \setmainfont{Garamond Premier Pro}
\setmainfont{GaramondPremrPro.otf}
\begin{document}
hello
\end{document}

this didn't work as well :/

So I tried copying GaramondPremrPro.otf from the installed directory ($HOME/.local/share/fonts/) to the current directory, then it worked (it also works if I put them in a directory in the texmf tree). So I guess that the problem is with Ubuntu's font directory...


Addendum: Something I think it's odd...

Suppose I have only the file GaramondPremrPro.otf in the current directory and call the font by the file name:

\documentclass{article}
\usepackage{fontspec}
% \setmainfont{Garamond Premier Pro}
\setmainfont{GaramondPremrPro.otf}
\begin{document}
hello
\bfseries
hello
\end{document}

I get a only font substitution warning because LaTeX couldn't find the bold font file:

LaTeX Font Warning: Font shape `TU/GaramondPremrPro.otf(0)/bx/n' undefined
(Font)              using `TU/GaramondPremrPro.otf(0)/m/n' instead on input line 7.

However, if I call the font by its name:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Garamond Premier Pro}
% \setmainfont{GaramondPremrPro.otf}
\begin{document}
hello
\bfseries
hello
\end{document}

I get the cryptic cannot find file '' from above.

If I remove the \bfseries instruction, both versions work.

  • 1
    It works for me. – Thérèse Oct 2 '18 at 14:49
  • 2
    If lualatex wouldn't find the font at all the error message would be different. What happens if you use the file name with extension (something like \setmainfont{xxx.otf})? – Ulrike Fischer Oct 4 '18 at 7:04
  • 3
    Have you tried \setmainfont{Garamond Premier Pro}[Path = $HOME/.local/share/fonts/]? – Mico Oct 4 '18 at 14:05
  • 2
    The update wouldn't change the way luaotfload searches fonts, it address some other problems. Search by font name is different in xelatex and lualatex. Do other fonts in this folder work? You could also check your font in the name database \texmf-var\luatex-cache\generic\names and check if there are other fonts with this name which could confuse luaotfload. – Ulrike Fischer Oct 4 '18 at 14:13
  • 3
    Just saw the edit: the behaviour with \bfseries means that fontspec can't really identify the corresponding bold font. That can happen (font names are sometimes odd) and you can resolve this by using the BoldFont option. – Ulrike Fischer Oct 4 '18 at 14:16
3

It seems that one of the cache files was broken.

After deleting the cache files in

/usr/local/texlive/2018/texmf-var/luatex-cache/generic/names/

and in

/usr/local/texlive/2018/texmf-var/luatex-cache/generic/fonts/otl

and letting luaotfload recreate everything the font could be used.

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.