[lltx] luaotfload and OSFONTDIR

Ulrike Fischer news3 at nililand.de
Mon Jul 25 18:35:24 CEST 2011

Am Mon, 25 Jul 2011 16:25:27 +0200 schrieb Philipp Stephani:

> 2011/7/25 Ulrike Fischer <news3 at nililand.de>:
>> The code in luaotfload which generates the font cache
>> (otfl-font-nms.lua) contains the comment

>> Does setting somehow OSFONTDIR actually work somewhere?

>> I couldn't find anything in the code that looked as if luaotfload
>> would actually use it (apart from log-lines).
> The magic is in the distribution's texmf.cnf (e.g.,
> /usr/local/texlive/2011/texmf/web2c/texmf.cnf):
> % TrueType outline fonts.
> TTFONTS = .;$TEXMF/fonts/{truetype,opentype}//;$OSFONTDIR//
> % OpenType outline fonts.
> OPENTYPEFONTS = .;$TEXMF/fonts/{opentype,truetype}//;$OSFONTDIR//
> And these variables are used by luaotfload:
>     local fontdirs = expandpath("$OPENTYPEFONTS"):gsub("^\.", "")
>     fontdirs = fontdirs .. expandpath("$TTFONTS"):gsub("^\.", "")

Thanks, this make sense. 

>> And various tests
>> didn't do something either. (I'm not quite sure what in this context
>> "OSFONTDIR" is -- a variable in texmf.cnf or an environment
>> variable).

And I now know why it doesn't work for me: I have miktex and beside
this a small "TeXLive-like" luatex installation based on w32tex.org
binaries which naturally used a texmf.cnf.

To test things with the second luatex I set path=path\to\luatex\bin
- and this broke the parsing of the font directories and texmf.cnf
variables. luaoftload suddenly splitted pathes at colons, a not very
good idea on windows. The cause is this code in lualibs-io-lua:

if string.find(os.getenv("PATH"),";") then
    io.fileseparator, io.pathseparator = "\\", ";"
    io.fileseparator, io.pathseparator = "/" , ":"

Ulrike Fischer 

More information about the lualatex-dev mailing list