[lltx] mkluatexfontdb & Mac OS X

Will Robertson wspr81 at gmail.com
Sat May 15 07:15:51 CEST 2010


A few problems with mkluatexfontdb.

* * *

I think mkluatexfontdb is erroneously running fc-list on Mac OS X to locate external fonts.

Here's the snippet from otfl-font-nms:

    This function scans the OS fonts through fontcache (fc-list), it executes
    only if OSFONTDIR is empty (which is the case under most Unix by default).
    If OSFONTDIR is non-empty, this means that the system fonts it contains have
    already been scanned, and thus we don't scan them again.

For a start, I'm not even sure how I got fontconfig on my machine; it's not part of Mac OS X but I think it turned up along with ImageMagick or some other similar program.

* * *

The actual error that is being reported is:

luaotfload | executing 'fc-list : file' and parsing its result..../otfl-font-nms.lua:441: bad argument #1 to 'lower' (string expected, got nil)

which occurs if there's a font without an extension; I've fixed that up with a quick check for nil before the lowercase happens.

After fixing that up, I now run into

luaotfload | loading font: /usr/X11R6/lib/X11/fonts/OTF/SyrCOMUrhoyBold.otf
Bus error

which isn't as easy for me to diagnose.

Long story short: skip fc-list if at all possible.

* * *

So how do we do this? On Mac OS X I think the script should perform something like (bash shell)

export OSFONTDIR=~/Library/Fonts:/Library/Fonts:/System/Library/Fonts

but I don't know how to execute this locally within the Lua script. Doing this on the command line, I then get the following error:

luaotfload ø loading font: /Library/Fonts/NISC18030.ttf./otfl-font-nms.lua:255: bad argument #1 to 'close' (fontloader.splinefont expected, got nil)

Performing the following "fix" to work around that problem:

    local f = fontloader.open(filename, subfont)
    if not nil then -- is there a better way to do this??
      return t 

I then get

luaotfload | loading font: /Library/Fonts/华文楷体.ttf
Bus error

which again I can't diagnose.

Any thoughts?

-- Will

More information about the lualatex-dev mailing list