diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-04-28 21:34:54 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-04-28 21:34:54 +0200 |
commit | 2727f911e924b77af85c60aacff82517cf70ca84 (patch) | |
tree | 0f787fb0bb1b6119e88594b0d16a173bea2d11e8 | |
parent | 619d652ec4e23339ed0db2c68dafcbfbcdf90b08 (diff) | |
download | luaotfload-2727f911e924b77af85c60aacff82517cf70ca84.tar.gz |
[conf] handle corner cases when assigning the lookup sequence
-rw-r--r-- | src/luaotfload-configuration.lua | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index a15474c..abc2657 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -96,6 +96,8 @@ local default_anon_sequence = { "tex", "path", "name", } +local valid_resolvers = tabletohash (default_anon_sequence) + local feature_presets = { arab = tabletohash { "ccmp", "locl", "isol", "fina", "fin2", @@ -514,10 +516,33 @@ local option_spec = { if s ~= "default" then local bits = { lpegmatch (commasplitter, s) } if next (bits) then - logreport ("both", 2, "conf", - "overriding anon lookup sequence %s.", - tableconcat (bits, ",")) - return bits + local seq = { } + local done = { } + for i = 1, #bits do + local bit = bits [i] + if valid_resolvers [bit] then + if not done [bit] then + done [bit] = true + seq [#seq + 1] = bit + else + logreport ("both", 0, "conf", + "ignoring duplicate resolver %s at position %d \z + in lookup sequence", + bit, i) + end + else + logreport ("both", 0, "conf", + "lookup sequence contains invalid item %s \z + at position %d.", + bit, i) + end + end + if next (seq) then + logreport ("both", 2, "conf", + "overriding anon lookup sequence %s.", + tableconcat (seq, ",")) + return seq + end end end return default_anon_sequence |