summaryrefslogtreecommitdiff
path: root/luaotfload.dtx
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2013-05-14 00:22:28 -0700
committerElie Roux <elie.roux@telecom-bretagne.eu>2013-05-14 00:22:28 -0700
commit718782c1cd45436cae846bb023733b01f1553866 (patch)
treea80d4e48582f4148f6d96b5fd012261963ec76d8 /luaotfload.dtx
parente94b87ca829b94e696d770d79f84f333df01b5cf (diff)
parent646092976d0686a566554039b3f426a55b4f1266 (diff)
downloadluaotfload-718782c1cd45436cae846bb023733b01f1553866.tar.gz
Merge pull request #71 from phi-gamma/master
tolerance for invalid lookups
Diffstat (limited to 'luaotfload.dtx')
-rw-r--r--luaotfload.dtx40
1 files changed, 33 insertions, 7 deletions
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