17

My Fedora 17 LuaLaTeX (2012) system just keeps complaining about some particular (of course existing) font not existing. It can't spit out any PDF from a TeX file using that font. This is the error I am getting:

!LuaTeX error: cannot find OpenType font file for reading () ==> Fatal error occurred, no output PDF file produced!

I am 100% positive the otf font file exists and that the path I am giving to setmainfont is correct.

After perusing TeX StackExchange searching for help, I couldn't find any recommendation that worked.

Can anyone help?

escudito
  • 431
  • 1
    Hi and welcome to TeX.sx. It's perfectly fine to ask a question and then answer it. This would be preferable to having an answer in the question. So perhaps you can edit your question just showing the error you got originally and then add your own answer as an answer. This way the question doesn't remain perpetually unanswered. – Alan Munn Jul 28 '12 at 16:06
  • 1
    Where exactly is the font? And how exactly are you calling it with setmainfont? – Ulrike Fischer Jul 28 '12 at 17:17
  • 1
    Try fclist | grep <fontname> to see whether the font is installed or not. – Marco Daniel Jul 28 '12 at 18:36
  • Does running mkluatexfontdb help? – Martin Schröder Jul 29 '12 at 15:35
  • I'm afraid I cannot say, Martin. My problems are gone since I deleted the broken .lua files as I explained in my own answer. So trying mkluatexfontdb does nothing now (apart from a trivial information message). – escudito Jul 29 '12 at 17:15
  • It usually means the font path luaotfload is passing to the engine does not exist, and this usually happens when the files are moved but luaotfload didn't update its font database. – خالد حسني Jul 29 '12 at 19:03
  • Khaled, if you mean the font files are moved, they weren't. What I think happened is this: some lua font cache job was interrupted and a corrupted lua font cache file was the result. Please see my own solution below. – escudito Jul 30 '12 at 01:43
  • @MartinSchröder I have the same problem. Clearing the cache does not work and mkluatexfontdb returns The program 'mkluatexfontdb' is currently not installed. You can install it by typing: sudo apt-get install texlive-luatex even though attempting to install texlive-luatex returns the message that it is already installed. – Alex Loomis Feb 02 '14 at 04:49

1 Answers1

23

I just found a solution.

It turned out it was all about cleaning my LuaTeX font cache.

Try that if you face the same problem. Go to your home folder. Activate viewing of hidden files (Ctrl+H). Look for .texlive2012/texmf-var/luatex-cache/generic/fonts/otf and delete the .lua file(s) that more closely match your "existing but not found" fontname.

That did the trick in my case, and forever. I suppose an interrupted PDF compilation was the culprit.

escudito
  • 431
  • 1
    Bingo, this answer is a lifesaver. It's important to note that the font you need to delete might be the one just after the ones reported before the fatal error, i.e. it might not be reported in the LaTeX output. – E.P. Sep 21 '17 at 21:55
  • This one helped for me as well - I had to delete the entire otl folder though (see also here: https://tex.stackexchange.com/questions/416183/setmainfont-error-on-path-2-levels-deep) – rammelmueller Jan 22 '20 at 08:35
  • 1
    On macOS the relevant path seems to be ~/Library/texlive/2021/texmf-var/luatex-cache/generic/fonts/. – orthocresol Feb 04 '22 at 15:12
  • This saved me hours (after hours spent). – Rico Picone Apr 05 '23 at 01:02