# luaotfload: how to use font in current directory?

I'd like to use a font in the current directory with luaotfload. I tried to generate the database:

OSFONTDIR=$PWD mkluatexfontdb  but this gives me endless output of: $ OSFONTDIR=\$PWD mkluatexfontdb

luaotfload | Updating the font names database:
This can take several minutes; please be patient.
luaotfload | Updating the font names database:
This can take several minutes; please be patient.
luaotfload | Updating the font names database:
...


What can I do do to use a (OTF) font in the current directory with luaotfload?

-
looks like a problem with luaotfload, please report at github.com/khaledhosny/luaotfload/issues –  Philipp Jan 30 '11 at 19:55
also, luaotfload allows specifying fonts by file name. –  Philipp Jan 30 '11 at 19:58

The OSFONTDIR variable is, I think, not intended to be used like this.

Here's an example using both plain and LaTeX font loading (luaotfload.sty can be \input in plain TeX if you're not using LaTeX):

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\normalfont normal font
hello again
\end{document}


For the fontspec example, it auto-detects that it's a font from the filesystem by the existence of .otf at the end of the name. If this doesn't work for you, I think we'll need to do more debugging in another forum (the lualatex-dev mailing list would be a good idea).

-
No, it does not work (the plain TeX variant): Font \jss=file:JosefinSansStd-Light.otf at 12pt not loadable: metric data not found or bad. The LaTeX variant does not give me an error message but does not switch to the font either. –  topskip Jan 31 '11 at 6:36
With \fontspec[Path=/my/current/dir]{...} I get the same metric data not found-error. –  topskip Jan 31 '11 at 6:54
@Patrick — seems like a problem somewhere. Not sure if we can resolve this here. (I've edited my answer above.) –  Will Robertson Jan 31 '11 at 7:37
I will investigate further and see what I can do to track down the problem. –  topskip Jan 31 '11 at 7:43
it works now. Thanks (also to @Khaled Hosny) –  topskip Mar 22 '11 at 10:12

This should work:

\input luaotfload.sty
\directlua{fonts.names.scan(".")}
\font\test={name:Gota Light} % whatever the font is
\test test
\bye


But it does not work now because of a long undiscovered bug (you can fix it by replacing "zapfino" with dir in the file otfl-font-nms.lua.)

Fontspec's ExternalLocation would be extended to use this feature.

-
A fixed version have been uploaded to CTAN and is available in texlive now. –  Khaled Hosny Feb 5 '11 at 23:49