Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

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

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

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

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

Comments

@ro-di
Copy link

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:/')
end

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
Copy link
Collaborator

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
Copy link
Author

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
~/.texlive2011/texmf-var/luatex-cache/generic/names/otfl-names.lua.
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
.;$TEXMF/fonts/{data,opentype}//;$OSFONTDIR

$ luatools --var-value OSFONTDIR
/cygdrive/c/windows/fonts

$ kpsewhich --var-value OPENTYPEFONTS
.:{/home/Rolf/.texlive2011/texmf-config,/home/Rolf/.texlive2011/texmf-var,/home/
Rolf/texmf,!!/usr/local/texlive/2011/texmf-config,!!/usr/local/texlive/2011/texm
f-var,!!/usr/local/texlive/2011/texmf,!!/usr/local/texlive/texmf-local,!!/usr/lo
cal/texlive/2011/texmf-dist}/fonts/{opentype,truetype}//:/cygdrive/c/windows/fon
ts//

$ kpsewhich --var-value OSFONTDIR
/cygdrive/c/windows/fonts

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.

Bye
Rolf

@eroux
Copy link
Collaborator

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:/')
end
elseif os.name == "cygwin" then
path = path:gsub('(%a):/', '^/cygdrive/%1/')
end

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

Thank you,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants