LuaTeX Fonts – How to List Fonts Available to LuaTeX in ConTeXt (TeX Live 2013)

context-mkivluatex

I've looked at How do I get a list of all available fonts for luaotfload?, but the answers don't work for me in TeX Live 2013, at least not without LaTeX. This is because there they rely on the file otfl-names.lua under \luatex-cache\generic\names; but in my installations of TeX Live 2013 (ConTeXt scheme), the only directory under \luatex-cache is context, and there is no otfl-names.lua that I can find.

P.S. Following this comment, I also looked for luaotfload-names.lua, but can't find that file either. Do I need to run a program to build it? I looked for mkluatexfontdb but no such command seems to exist.

I tried the following ConTeXt mkiv (LuaTeX) document:

\starttext
\startluacode
myfonts=dofile(fonts.names.path.path)

for i,v in ipairs(myfonts.mappings) do
 tex.print(-2, v.familyname)
 tex.print(', ')
 tex.print(-2, v.fontname)
 tex.print('\\par')
end

\stopluacode
\stoptext

But I get the error:

! LuaTeX error [string "\directlua "]:2: attempt to index field 'path'
(a nil value)

Any suggestions would be appreciated.

Best Answer

If all you need is a list of the registered fonts, you can run

mtxrun --script fonts --list --all

for Context, and

luaotfload-tool --list=*

for Lualatex/Luaotfload (see man 1 luaotfload-tool for details).

If you did not yet build the font indices you will have to do so before running above commands, e.g.

mtxrun --script fonts --reload

and

luaotfload-tool --update
Related Question