summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-27 16:38:28 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-27 16:38:28 +0200
commitee9575c0015f06571d238a87e982595c9d996c54 (patch)
tree96cc9ec93086aa744806414809ec6da27757bb1e
parent2dd656af102316c8846acd095cb8eccdc8b41e53 (diff)
downloadluaotfload-ee9575c0015f06571d238a87e982595c9d996c54.tar.gz
provide hook for custom font resolver
-rw-r--r--luaotfload-features.lua8
-rw-r--r--luaotfload.dtx13
2 files changed, 17 insertions, 4 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index cbdc36b..c405ae5 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -1003,9 +1003,11 @@ local prefixed = P"name:" * ws * Cg(fontname, "name")
--- with paths already, so we’ll add a less strict rule here. anyways,
--- we’ll emit a warning.
+ P"file:" * ws * Cg(unsupported, "path")
- + P"file:" * ws * Cg(fontname, "file")
+ + P"file:" * ws * Cg(fontname, "file")
--- EXPERIMENTAL: kpse lookup
- + P"kpse:" * ws * Cg(fontname, "kpse")
+ + P"kpse:" * ws * Cg(fontname, "kpse")
+--- EXPERIMENTAL: custom lookup
+ + P"my:" * ws * Cg(fontname, "my")
local unprefixed = Cg(fontname, "anon")
local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk
@@ -1071,7 +1073,7 @@ local import_values = {
{ "mode", true },
}
-local lookup_types = { "anon", "file", "kpse", "name", "path" }
+local lookup_types = { "anon", "file", "kpse", "my", "name", "path" }
local select_lookup = function (request)
for i=1, #lookup_types do
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 83885a0..7beca09 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1917,7 +1917,7 @@ request_resolvers.path = function (specification)
end
% \end{macrocode}
-% {\bfseries EXPERIMENTAL}
+% {\bfseries EXPERIMENTAL}:
% \identifier{kpse}-only resolver, for those who can do without system
% fonts.
%
@@ -1944,6 +1944,17 @@ request_resolvers.kpse = function (specification)
end
% \end{macrocode}
+% Also {\bfseries EXPERIMENTAL}:
+% custom file resolvers via callback.
+%
+% \begin{macrocode}
+create_callback("luaotfload.resolve_font", "simple", dummy_function)
+
+request_resolvers.my = function (specification)
+ call_callback("luaotfload.resolve_font", specification)
+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