5

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:
luaotfload | Font names database not found, generating new one.
             This can take several minutes; please be patient.
luaotfload | Updating the font names database:
luaotfload | Font names database not found, generating new one.
             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?

topskip
  • 37,020

2 Answers2

2

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.

2

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}
\font\1="file:MyriadPro-BlackCond.otf" at 12pt\1 hello
\normalfont normal font
\fontspec{MyriadPro-BlackCond.otf}
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 06:36
  • With \fontspec[Path=/my/current/dir]{...} I get the same metric data not found-error. – topskip Jan 31 '11 at 06: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 07:37
  • I will investigate further and see what I can do to track down the problem. – topskip Jan 31 '11 at 07:43
  • it works now. Thanks (also to @Khaled Hosny) – topskip Mar 22 '11 at 10:12