diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-13 20:42:38 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-13 20:42:38 +0200 |
commit | 2c79c7d38d6dcb41f52eb7f44fb744771408ec39 (patch) | |
tree | 47b731240d19a5aa66588904655d5fa468dc050c | |
parent | 69e1a2d1249afc6d661e78483f74669ce7868284 (diff) | |
download | luaotfload-2c79c7d38d6dcb41f52eb7f44fb744771408ec39.tar.gz |
work around unsupported full paths in anon lookups
windows only: http://tug.org/pipermail/lualatex-dev/2013-May/001519.html
-rw-r--r-- | luaotfload-features.lua | 2 | ||||
-rw-r--r-- | luaotfload.dtx | 40 |
2 files changed, 34 insertions, 8 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua index e732ed9..33b529f 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -1053,7 +1053,7 @@ local handle_request = function (specification) specification.specification) report("log", 0, "load", "use square bracket syntax or consult the documentation.") specification.name = specification.specification - specification.lookup = "file" + specification.lookup = "path" return specification end local lookup, name = select_lookup(request) diff --git a/luaotfload.dtx b/luaotfload.dtx index e576112..16f7bf6 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1832,13 +1832,13 @@ local resolvefile = fonts.names.crude_file_lookup --local resolvefile = fonts.names.crude_file_lookup_verbose function request_resolvers.file(specification) - local name=resolvefile(specification.name) - local suffix=file.suffix(name) + local name = resolvefile(specification.name) + local suffix = file.suffix(name) if formats[suffix] then - specification.forced=suffix - specification.name=file.removesuffix(name) + specification.forced = suffix + specification.name = file.removesuffix(name) else - specification.name=name + specification.name = name end end @@ -1869,6 +1869,7 @@ end % For this reason, we introduce an extra check with an early return. % % \begin{macrocode} + local type1_formats = { "tfm", "ofm", } request_resolvers.anon = function (specification) @@ -1880,6 +1881,20 @@ request_resolvers.anon = function (specification) return end end + --- under some weird circumstances absolute paths get + --- passed to the definer; we have to catch them + --- before the name: resolver misinterprets them. + name = specification.specification + local exists, _ = lfsisfile(name) + if exists then --- garbage; we do this because we are nice, + --- not because it is correct + logs.names_report("log", 1, "load", "file ā%sā exists", name) + logs.names_report("log", 1, "load", + "... overriding borked anon: lookup with path: lookup") + specification.name = name + request_resolvers.path(specification) + return + end request_resolvers.name(specification) end @@ -1892,9 +1907,21 @@ end % % \begin{macrocode} request_resolvers.path = function (specification) - local exists, _ = lfsisfile(specification.name) + local name = specification.name + local exists, _ = lfsisfile(name) if not exists then -- resort to file: lookup + logs.names_report("log", 1, "load", + "path lookup of ā%sā unsuccessful, falling back to file:", + name) request_resolvers.file(specification) + else + local suffix = file.suffix(name) + if formats[suffix] then + specification.forced = suffix + specification.name = file.removesuffix(name) + else + specification.name = name + end end end @@ -1956,7 +1983,6 @@ loadmodule"auxiliary.lua" --- additionaly high-level functionality (new) -- vim:tw=71:sw=4:ts=4:expandtab - % \end{macrocode} % % \iffalse |