From 54e74772fab02405bf90362d76884e88b63eb381 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 12 Nov 2015 08:15:06 +0100 Subject: [conf] implement path-based fontloader specification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes the config test for paths specified as “context:/path/to/texmf” and return a ("context", path) pair that is intended for use as the base path of the fontloader files. --- src/luaotfload-configuration.lua | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-configuration.lua') diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index 1fe30fe..4ac8c50 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -134,6 +134,33 @@ local registered_loaders = { tl2014 = "tl2014", } +local pick_fontloader = function (s) + local ldr = registered_loaders[s] + if ldr ~= nil and type (ldr) == "string" then + logreport ("log", 2, "conf", "Using predefined fontloader \"%s\".", ldr) + return ldr + end + local idx = stringfind (s, ":") + if idx and idx > 2 then + if stringsub (s, 1, idx - 1) == "context" then + local pth = stringsub (s, idx + 1) + pth = stringstrip (pth) + logreport ("log", 2, "conf", "Context base path specified at \"%s\".", pth) + if lfsisdir (pth) then + logreport ("log", 5, "conf", "Context base path exists at \"%s\".", pth) + return { "context", pth } + end + pth = kpseexpand_path (pth) + if lfsisdir (pth) then + logreport ("log", 5, "conf", "Context base path exists at \"%s\".", pth) + return { "context", pth } + end + logreport ("both", 0, "conf", "Context base path not found at \"%s\".", pth) + end + end + return nil +end + --[[doc-- The ``post_linebreak_filter`` has been made the default callback for @@ -468,10 +495,8 @@ local option_spec = { in_t = string_t, out_t = string_t, transform = function (id) - local ldr = registered_loaders[id] + local ldr = pick_fontloader (id) if ldr ~= nil then - logreport ("log", 2, "conf", - "Using predefined fontloader \"%s\".", ldr) return ldr end logreport ("log", 0, "conf", -- cgit v1.2.3