diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-19 13:34:01 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-19 13:34:01 +0200 |
commit | bb65ba28ea757225f9bb5707c631e8444db5954e (patch) | |
tree | 4116323702ed7ccbd0569cc96f7f1e199def3dc1 /luaotfload-features.lua | |
parent | d904df22170aff308c2b3ebada4fcbb29be85af1 (diff) | |
download | luaotfload-bb65ba28ea757225f9bb5707c631e8444db5954e.tar.gz |
emit warning for invalid font request options
Diffstat (limited to 'luaotfload-features.lua')
-rw-r--r-- | luaotfload-features.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua index b4ad9c9..415d2ac 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -754,6 +754,7 @@ local support_incomplete = table.tohash({ --- (string, string) dict -> (string, string) dict local set_default_features = function (speclist) speclist = speclist or { } + speclist[""] = nil --- invalid options stub --- handle language tag local language = speclist.language @@ -913,6 +914,22 @@ end --[[doc-- + Instead of silently ignoring invalid options we emit a warning to + the log. + + Note that we have to return a pair to please rawset(). This creates + an entry on the resulting features hash which will later be removed + during set_default_features(). + +--doc]]-- + +local handle_invalid_option = function (opt) + report("log", 0, "load", "font option “%s” unknown.", opt) + return "", false +end + +--[[doc-- + Dirty test if a file: request is actually a path: lookup; don’t ask! Note this fails on Windows-style absolute paths. These will *really* have to use the correct request. @@ -1006,7 +1023,8 @@ local assignment = xetex_option / handle_xetex_option local switch = P"+" * ws * C(field) * Cc(true) + P"-" * ws * C(field) * Cc(false) -- + C(field) * Cc(true) -- catch crap -local ignore = (1 - featuresep)^1 --- ignores one option +local ignore = (1 - featuresep)^1 --- ignores one option + / handle_invalid_option local feature_expr = ws * Cg(assignment + switch) * ws local option = feature_expr + ignore local feature_list = Cf(Ct"" @@ -1136,8 +1154,8 @@ local handle_request = function (specification) specification.lookup = "path" return specification end - local lookup, name = select_lookup(request) - request.features = set_default_features(request.features) + local lookup, name = select_lookup(request) + request.features = set_default_features(request.features) if name then specification.name = name |