summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--luaotfload-features.lua2
-rw-r--r--luaotfload.dtx40
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