···<date: 2013-06-29, Saturday>···<from: Evan Cooch>··· > On 6/29/2013 3:56 PM, Philipp Gesang wrote: > >···<date: 2013-06-29, Saturday>···<from: Evan Cooch>··· > > > >>For a variety of reasons, luaotfload doesn't 'find' fonts in TEXMF, > >>so you need to hack lualibs-dir.lua, as per > >> > >>http://tex.stackexchange.com/questions/47156/luaotfload-cant-find-fonts > >> > >>Basically, you add > >> > >>P("(") / "%%(" + > >>P(")") / "%%)" + > >That modifies the globbing mechanism globally which is not a good > >idea because other packages might depend on its exact behavior. > > Fair enough, but without this hack, or something analogous, you > can't use fonts in TEXMF (at least, for the next to most recent > version of MikTeX. > > >That won’t have any effect as the file isn’t loaded directly but > >rather as part of a combined version of all the libraries; see > >the manual. Also, since a good deal of the required functionality > >comes prepackaged in the fontloader, luaotfload does not anymore > >load the lualibs during a Luatex run. (luaotfload-tool does, > >though.) Instead, there’s a separate version of l-dir named > >luaotfload-lib-dir.lua, so you’ll have to patch that one too. > > Ah, didn't know that (I suspect its not common knowledge).
The manual describes quite extensively what each file does and how it is supposed to be used. > I'll give > that a try... > > Making the change didn't solve the problem. luaotfload-tool --update > --force still exits before completion. > > >>t > >Not a luaotfload thing, as I wrote previously, this could be a > >buggy font. Does it terminate correctly if you run: > > > > luaotfload-tool --update --force --verbose=5 --dry-run > > > >? > > No -- with or without the --dry-run flag, it terminates. The > termination always occurs after it has started scanning my working > directory (which happens to be the Desktop for my account, which > again is an admin account). Please try the attached patch for luaotfload. Best, Philipp
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 60e321f..ae3667b 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -62,6 +62,14 @@ local stringstrip = string.strip
local tableappend = table.append
local tabletohash = table.tohash
+local lpeg = require "lpeg"
+
+local C, Cc, Cf, Cg, Cs, Ct
+ = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cs, lpeg.Ct
+
+local P, R, S, lpegmatch
+ = lpeg.P, lpeg.R, lpeg.S, lpeg.match
+
--- the font loader namespace is “fonts”, same as in Context
--- we need to put some fallbacks into place for when running
--- as a script
@@ -124,6 +132,17 @@ local sanitize_string = function (str)
return nil
end
+local preescape_path --- working around funky characters
+do
+ local escape = function (chr) return "%" .. chr end
+ local funkychar = S"()[]"
+ local pattern = Cs((funkychar/escape + 1)^0)
+
+ preescape_path = function (str)
+ return lpegmatch (pattern, str)
+ end
+end
+
--[[doc--
This is a sketch of the luaotfload db:
@@ -1078,8 +1097,10 @@ local scan_dir = function (dirname, fontnames, newfontnames, dry_run)
report("both", 2, "db", "scanning directory %s", dirname)
for _,i in next, font_extensions do
for _,ext in next, { i, stringupper(i) } do
- local found = dirglob(stringformat("%s/**.%s$", dirname, ext))
- local n_found = #found
+ local escapeddir = preescape_path (dirname)
+ local found = dirglob (stringformat("%s/**.%s$",
+ escapeddir, ext))
+ local n_found = #found
--- note that glob fails silently on broken symlinks, which
--- happens sometimes in TeX Live.
report("both", 4, "db", "%s '%s' fonts found", n_found, ext)
@@ -1145,14 +1166,6 @@ end
local read_fonts_conf
do --- closure for read_fonts_conf()
- local lpeg = require "lpeg"
-
- local C, Cc, Cf, Cg, Ct
- = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Ct
-
- local P, R, S, lpegmatch
- = lpeg.P, lpeg.R, lpeg.S, lpeg.match
-
local alpha = R("az", "AZ")
local digit = R"09"
local tag_name = C(alpha^1)
@@ -1307,7 +1320,9 @@ do --- closure for read_fonts_conf()
path, home, xdg_home,
acc, done, dirs_done)
elseif lfsisdir(path) then --- arrow code ahead
- local config_files = dirglob(filejoin(path, "*.conf"))
+ local escapedpath = preescape_path (path)
+ local config_files = dirglob
+ (filejoin(escapedpath, "*.conf"))
for _, filename in next, config_files do
if not done[filename] then
acc = read_fonts_conf_indeed(
@@ -1573,7 +1588,8 @@ end
local collect_cache collect_cache = function (path, all, n, luanames,
lucnames, rest)
if not all then
- local all = dirglob(path .. "/**/*")
+ local escapedpath = preescape_path (path)
+ local all = dirglob (escapedpath .. "/**/*")
local luanames, lucnames, rest = { }, { }, { }
return collect_cache(nil, all, 1, luanames, lucnames, rest)
end
pgpLRzdGSvr07.pgp
Description: PGP signature
