How to list all available LuaLaTeX and LuaTeX fonts (MacTex)

As a quick note, this URL shared a script to list all of the LuaLaTeX font names, and it almost worked for me.

The third line in the source code didn’t work for me, so I replaced it will a hard-coded path to the luaotfload-names.luc file. I’m using MacTex, and I found that file in the directory shown in the following script, which you’ll need to change on your system. With that change, this resulting script worked for me, listing all of the LuaLaTeX font names:

#!/usr/bin/env texlua

kpse.set_program_name("ListLuatexFonts")

cachefile = "/Users/al/Library/texlive/2016/texmf-var/luatex-cache/generic/names/luaotfload-names.luc"
fontlist = dofile(cachefile)
assert(fontlist,"Could not load font name database")

local tmp = {}

for _,font in ipairs(fontlist.mappings) do
  tmp[#tmp + 1] = font.fontname
end
table.sort(tmp)

for _,fontname in ipairs(tmp) do
  print(fontname)
end

As the second line of code there implies, I named this script ListLuatexFonts. I put this source code in this file, then made the file executable on my Mac OS X (macOS) system, like this:

chmod +x ListLuatexFonts

Then ran the script like this:

./ListLuatexFonts

Unfortunately that results in over 1,400 LuaLaTeX font names, so what I did next was redirect that output to a file like this:

./ListLuatexFonts > LuatexFonts.txt

I could then look at that file with a text editor to see what fonts are available to me.

At the moment I’m just getting started with LaTeX again after more than five years away from it, so I don’t know the difference between LuaLaTeX and LuaTeX, but if you’re interested in what fonts are available to you, I hope this script is helpful, and of course many thanks to the original author for this script (which was originally written by other people before him, so we’re all just passing it on).

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.