summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-27 15:10:21 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-27 15:10:21 +0200
commit1ef6591eecdbb9cd047b80992dc71beb287fa3e6 (patch)
treeff5fb7052c6ca9238e1d0cae7e4d0fedafa090a6
parentcdc347c5136e1c6e330fb81af0912103361b0f3e (diff)
downloadluaotfload-1ef6591eecdbb9cd047b80992dc71beb287fa3e6.tar.gz
implement kpse-only font resolver
-rw-r--r--luaotfload.dtx29
1 files changed, 28 insertions, 1 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index b4b7940..83885a0 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1797,7 +1797,7 @@ loadmodule"colors.lua" --- “font-clr”
% \begin{macrocode}
local request_resolvers = fonts.definers.resolvers
-local formats = fonts.formats
+local formats = fonts.formats -- nice table; does lowercasing ...
formats.ofm = "type1"
% \end{macrocode}
@@ -1917,6 +1917,33 @@ request_resolvers.path = function (specification)
end
% \end{macrocode}
+% {\bfseries EXPERIMENTAL}
+% \identifier{kpse}-only resolver, for those who can do without system
+% fonts.
+%
+% \begin{macrocode}
+
+request_resolvers.kpse = function (specification)
+ local name = specification.name
+ local suffix = file.suffix(name)
+ if suffix and formats[suffix] then
+ name = file.removesuffix(name)
+ if resolvers.findfile(name, suffix) then
+ specification.forced = suffix
+ specification.name = name
+ return
+ end
+ end
+ for t, format in next, formats do --- brute force
+ if kpse.find_file (name, format) then
+ specification.forced = t
+ specification.name = name
+ return
+ end
+ end
+end
+
+% \end{macrocode}
% We create a callback for patching fonts on the fly, to be used by other
% packages.
% It initially contains the empty function that we are going to override