diff options
| author | Philipp Gesang <phg@phi-gamma.net> | 2015-11-12 08:15:06 +0100 | 
|---|---|---|
| committer | Philipp Gesang <phg@phi-gamma.net> | 2015-11-12 08:15:13 +0100 | 
| commit | 54e74772fab02405bf90362d76884e88b63eb381 (patch) | |
| tree | e06f9b5cdf7ffd65c73e40478193110ff3ec5ce7 /src/luaotfload-configuration.lua | |
| parent | 952d2c9b24c1b2e6f0f48df28981c1f2674137f4 (diff) | |
| download | luaotfload-54e74772fab02405bf90362d76884e88b63eb381.tar.gz | |
[conf] implement path-based fontloader specification
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.
Diffstat (limited to 'src/luaotfload-configuration.lua')
| -rw-r--r-- | src/luaotfload-configuration.lua | 31 | 
1 files changed, 28 insertions, 3 deletions
| 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", | 
