# fontspec and local (relative) directory

I want to install a (ttf) font in a local, relative directory and use it with fontspec / texlive 2015. For example I download TheanoDidot-Regular.ttf from http://www.fonts2u.com/theano-didot-regular.font and put it in the current directory where this test file is:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{TheanoDidot}[
Extension      = .ttf ,
UprightFont    = *-Regular,
]

\begin{document}
Hello world
\end{document}


This works fine.

Now I put the file in a directory called myfonts. I have no clue why LuaTeX/fontspec does not like my setting.

mkdir myfonts
mv TheanoDidot-Regular.ttf myfonts/


The following file gives an error:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{TheanoDidot}[
Path           = myfonts/,
Extension      = .ttf ,
UprightFont    = *-Regular,
]

\begin{document}
Hello world
\end{document}


gives

....
live2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux))
306 words of node memory still in use:
3 hlist, 1 vlist, 1 rule, 2 glue, 1 kern, 4 attribute, 43 glue_spec, 4 attrib
ute_list, 1 write nodes
avail lists: 2:47,3:4,4:23,5:1,6:17,7:1,9:6

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


What can I do to access the font?

\$ luatex --version
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238)

• You need to delete the lua/luc-file of the font from ...\texmf-var\luatex-cache\generic\fonts\otf. It contains the old path to the font and so confuse luatex. – Ulrike Fischer May 25 '16 at 15:59
• @UlrikeFischer thank you, that works. If you post this as an answer, I'll be happy to accept this (and give you 10 points ;-)) – topskip May 25 '16 at 16:13
• I really like LaTeX's intuitive usage.... – topskip May 25 '16 at 16:17

You need to delete the lua/luc-file of the font from ...\texmf-var\luatex-cache\generic\fonts\otf.

It contains the old path to the font and so confuse luatex.

I'm not sure if it is worth if luaotfload adds a check for this case to recreate the cachefile but you could open an issue https://github.com/lualatex/luaotfload/issues.