diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-12 22:44:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-12 22:44:11 +0000 |
commit | c63c0a57f15b491b56b82104a6896e3f0630a778 (patch) | |
tree | 7d8233c705b4c20ad306ca43803a3af5a8647244 /Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua | |
parent | c6d3c3e07039be32f92e2f5c7fc23e41add48e32 (diff) |
luaotfload (12may13)
git-svn-id: svn://tug.org/texlive/trunk@30425 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua index f91aee7b9fe..220b362fe74 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua @@ -32,6 +32,7 @@ local old_feature_list = { } local report = logs.names_report +local stringfind = string.find local stringlower = string.lower local stringgsub = string.gsub local stringis_empty = string.is_empty @@ -212,13 +213,28 @@ local toboolean = function (s) if s == "false" then return false end --if s == "yes" then return true end --- Context style --if s == "no" then return false end - return s + return stringlower(s) +end + +--- dirty test if a file: request is actually a path: lookup; don’t +--- ask! +local check_garbage = function (_,i, garbage) + if stringfind(garbage, "/") then + report("log", 0, "load", --- ffs use path! + "warning: path in file: lookups is deprecated; ") + report("log", 0, "load", "use bracket syntax instead!") + report("log", 0, "load", + "position: %d; full match: “%s”", + i, garbage) + return true + end + return false end local lpegmatch = lpeg.match local P, S, R = lpeg.P, lpeg.S, lpeg.R -local C, Cc, Cf, Cg, Cs, Ct - = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cs, lpeg.Ct +local C, Cc, Cf, Cg, Cmt, Cs, Ct + = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cmt, lpeg.Cs, lpeg.Ct --- terminals and low-level classes ----------------------------------- --- note we could use the predefined ones from lpeg.patterns @@ -259,9 +275,17 @@ local modifier = slash * (other_modifier --> ignore local modifier_list = Cg(Ct(modifier^0), "modifiers") --- lookups ----------------------------------------------------------- -local fontname = C((1-S"/:(")^1) --- like luatex-fonts +local fontname = C((1-S":(/")^1) --- like luatex-fonts +local unsupported = Cmt((1-S":(")^1, check_garbage) local prefixed = P"name:" * ws * Cg(fontname, "name") - + P"file:" * ws * Cg(fontname, "file") +--- initially we intended file: to emulate the behavior of +--- luatex-fonts, i.e. no paths allowed. after all, we do have XeTeX +--- emulation with the path lookup and it interferes with db lookups. +--- turns out fontspec and other widely used packages rely on file: +--- with paths already, so we’ll add a less strict rule here. anyways, +--- we’ll emit a warning. + + P"file:" * ws * Cg(unsupported, "path") + + P"file:" * ws * Cg(fontname, "file") local unprefixed = Cg(fontname, "anon") local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk @@ -313,7 +337,9 @@ local import_values = { --- That’s what the 1.x parser did, not quite as graciously, --- with an array of branch expressions. -- "style", "optsize",--> from slashed notation; handled otherwise - "lookup", "sub", "mode", + { "lookup", false }, + { "sub", false }, + { "mode", true }, } local lookup_types = { "anon", "file", "name", "path" } @@ -387,11 +413,14 @@ local handle_request = function (specification) end for n=1, #import_values do - local feat = import_values[n] + local feat = import_values[n][1] + local keep = import_values[n][2] local newvalue = request.features[feat] if newvalue then specification[feat] = request.features[feat] - request.features[feat] = nil + if not keep then + request.features[feat] = nil + end end end |