Re: detailed 'diagnostic' of MikTeX/Lua*/fontspec issues
Philipp Gesang <[email protected]>
| Newsgroups | gmane.comp.tex.luatex.user,gmane.comp.tex.miktex |
|---|---|
| Message-ID | <20130629223145.GA30374@phlegethon> |
···<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
luaotfload-v2.2d.patch
(text/x-diff, 3.3 KB)
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
signature.asc
(application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQEcBAEBCgAGBQJRz2BRAAoJEI7yfcKNwM1++wQIAKpHiM3ho8HdCBkjEuQqV4+6 p1DKVpnaUsYmatpVXr7o6qnnIaVsDLyedTw3tjJwgy72b9qu9ncOuxXTKVCfJKKC kgURPmV7Y9tJHnO1gx6wlNcpk720KbQO9zHuTilDwyKnLeyh+8wJpF2+EdAzHzeT KuPu92kS+lO8b76XeroDiuVbIBtBAO+4xNL/kUddTCTMC8NHHEgHeIMQrgUhwK+P 62zS20aznxYu0BRMHvs4V3tJcmxFNeBATulNl4JpjW2Tx/F3Wc7uZleUCbWNIoy6 9D/Bf2jCrAg30t53Ww/N0AfA9I5JewcPRAhgjJMlnCdi8GRAELGhcG/fDYHBAvU= =1Bvu -----END PGP SIGNATURE-----