From bb65ba28ea757225f9bb5707c631e8444db5954e Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 19 May 2013 13:34:01 +0200 Subject: emit warning for invalid font request options --- luaotfload-features.lua | 24 +++++++++++++++++++++--- 1 file 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 @@ -911,6 +912,22 @@ local handle_xetex_option = function (key, val) return key, val 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 @@ -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 -- cgit v1.2.3