Faulty luatex-fonts-names.lua under Cygwin #33

ro-di opened this Issue Jun 25, 2011 · 3 comments


None yet

3 participants

ro-di commented Jun 25, 2011

mkluatexfontdb generates lines like
["filename"]={ "minionpro-regular.otf", false },
under Cygwin. Because file names in Cygwin are case-sensitive, the font MinionPro-Regular.otf e.g. cannot be found at runtime.

The local function path_normalize in otfl-font-nms.lua has these lines of codes:

if os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then
    path = path:gsub('\\', '/')
    path = path:lower()
    path = path:gsub('^/cygdrive/(%a)/', '%1:/')

For Cygwin all of the tree lines are unnecessary or defective:

  1. \ does not have to be substituted by / because the paths already use /
  2. Converting to lower case leads to the trouble of not finding font names with mixed upper and lower case letters.
  3. /cygdrive/c/windows/fonts is absolutly correct and should not be subtituted by c:/windows/fonts. At the end of the function, "file.collapse_path" removes the dir path, so this line of code is unnecessary anyway.

This shows once more that Cygwin behaves much more like Unix/Linux than Windows or DOS.
For os.name == "cygwin" these three lines of code should not be executed.

mpg commented Jun 27, 2011

Unless I'm mistaken, the goal of this path_normalize function is also to prevent duplicated entries. Since I don't have access to a cygwin installation right now, I can't test, but it may be possible that dome fonts (like those in windows\fonts) are found many times with apparently different pathnames, like c:\windows\fonts\foo.otf and /cygdrive/c/windows/fonts/foo.otf and we want to avoid detect such duplicates.

Can you try removing the or os.name == "cygwin" part of the test in this function and check if there are such duplicates in the cach file after that? (And obviously, check if it fixes you initial problem.) If everything is okay, I'll take your word for it and apply this patch.

ro-di commented Jul 3, 2011

Hi Manuel,

sorry for answering so late. I've been busy abroad from my Cygwin installation.

If I remove
or os.name == "cygwin"
there are no duplicates in
For example I checked CONSOLA.TTF.

But as I remarked above: I doubt that the job of eliminating duplicates can be achieved by this function because the dir path portion is truncated at the end (if file.collapse_path does what its name states).

I'm not an experienced TeX Live user on the Cygwin platform. Some weeks ago it was the first time ever I installed it and looked at it a little bit. I walked through the luaotfload code with a simple text editor. No Lua IDE, I haven't checked if path_normalize is used elsewhere. No test suite to check if my local changes in path_normalize affect other parts.

Here my settings, probably they are also relevant to avoid duplicates:

$ luatools --var-value OPENTYPEFONTS

$ luatools --var-value OSFONTDIR

$ kpsewhich --var-value OPENTYPEFONTS

$ kpsewhich --var-value OSFONTDIR

I still have no deep understanding if LuaTeX's kpse library is merely an OO interface or a re-implementation of kpsearch. And if texmfcnf.lua is used only by ConTeXt MkIV or also by LuaLaTeX. But investigating such issues is a good chance for me to get deeper into the material.


eroux commented Apr 9, 2013

Sorry to be more than late on the issue, but what about something like:

if os.type == "windows" or os.type == "msdos" then
path = path:gsub('', '/')
path = path:lower()
path = path:gsub('^/cygdrive/(%a)/', '%1:/')
elseif os.name == "cygwin" then
path = path:gsub('(%a):/', '^/cygdrive/%1/')

(not tested) ? If you are not able to test anymore, I'll try it on a VM...

Thank you,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment