[luatex] Reading registry to find Windows fonts

Hans Hagen pragma at wxs.nl
Sat May 30 13:33:28 CEST 2015

On 5/30/2015 11:50 AM, Élie Roux wrote:
> Dear All,
> An issue[0] was raised recently, from a user who had fonts installed
> under Windows, recognized by his softwares but not LuaTeX (nor XeTeX).
> Apparently[1] the fonts are installed through a mechanism documented by
> MS[2] consisting in adding the font in the list of fonts in the Windows
> Registry.

did the user update the font database

> Lua has several modules allowing to read the registry, there's an entry
> in the FAQ[3], and another module not listed in the FAQ[4].
> As ConTeXt may also benefit from reading the registry (there's a ConTeXt
> user in [2]), what do you think would be the best solution to access the
> registry from LuaTeX? Should a module like lua-winreg be distributed (as
> a dll) in TeXLive? Should it be built in LuaTeX?

such a dll would add yet another dependency (even worse: on an operating 

personally i'd never rely on this as for long term stable processing it 
makes sense to know what font (file) you use and where it sits

anyway, a dll is not needed as one can do this:

local command = [[reg QUERY "HKLM\SOFTWARE\Microsoft\Windows 
local pattern = ".-[\n\r]+%s+(.-)%s%(([^%)]+)%)%s+REG_SZ%s+(%S+)%s+"

local function getnamesfromregistry()
     local data = os.resultof(command)
     local list = { }
     for name, format, filename in string.gmatch(data,pattern) do
         list[name] = filename
     return list


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the luatex mailing list